public function editMediaAction(Product $product, Media $entity, $type, Request $request)
    {
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Media entity.');
        }

        $editForm = $this->mediaCreateEditForm($entity, $product, $type);

        return array(
            'entity' => $entity,
            'type' => $type,
            'product' => $product,
            'edit_form' => $editForm->createView(),
        );
    }