public function postMediaAction($provider, Request $request) {
    	$pool = $this->get("sonata.media.pool");
        $manager = $this->get("sonata.media.manager.media");
    	$formFactory = $this->get('form.factory');

    	try {
    		$mediaProvider = $pool->getProvider($provider);
    	} catch (\RuntimeException $ex) {
    		throw new NotFoundHttpException($ex->getMessage(), $ex);
    	}
    	$medium = $manager->create();
    	$medium->setProviderName($provider);
    	$form = $formFactory->createNamed(null, 'sonata_media_api_form_media', $medium, array(
    			'provider_name'   => $mediaProvider->getName(),
//    			'csrf_protection' => false
    	));

    	$form->bind($request);

    	if ($form->isValid()) {
            try {
	    		$medium = $form->getData();
	    		$manager->save($medium);
            } catch (DBALException $e) {
                return $this->handleView(
                    View::create(array('errors'=>array($e->getMessage())), 400)
                );
            }
            return $this->handleView(
                View::create($this->formatMedia($medium), 200, array('Location'=>$this->generateUrl(
                    "_togu_media_rest_get_media",
                    array('id'=>$medium->getId()),
                    true
                )))->setSerializationContext($this->getSerializerContext(array('sonata_api_read')))
            );
    	} else {
            return $this->handleView(
                View::create(array('errors'=>$form->getErrors()), 400)
            );
        }
    }