public function createAction(Request $request, $provider = 'image')
    {
        $dispatcher = $this->get('event_dispatcher');
        $event = new ResponseEvent($request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_NEW, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $mediaManager = $this->get('opifer.media.media_manager');
        $mediaProvider = $this->get('opifer.media.provider.pool')->getProvider($provider);

        $media = $mediaManager->createMedia();

        $form = $this->createForm(MediaType::class, $media, ['provider' => $mediaProvider]);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $mediaManager->save($media);

            $this->addFlash('success', sprintf('%s was succesfully created', $media->getName()));

            return $this->redirectToRoute('opifer_media_media_index');
        }

        return $this->render($this->container->getParameter('opifer_media.media_create_view'), [
            'form' => $form->createView(),
            'provider' => $mediaProvider,
        ]);
    }