public function addMediaProductAction(Product $product, $type = null)
    {
        if ($type == 'type_image_file') {
            return $this->redirectToRoute('admin_product_new_image', array('id' => $product->getId()));
        }
        $entity = new Media();
        $entity->setMediaType($type);
        $form = $this->mediaCreateCreateForm($entity, $product);

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