public function newAction(Request $request)
    {
        $actorClass = $this->container->get('core_manager')->getActorClass();
        $actor = new $actorClass();
        $form = $this->createForm($this->get('core_manager')->getActorBundleName().'\Form\ActorType', $actor);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            //crypt password
            $factory = $this->get('security.encoder_factory');
            $encoder = $factory->getEncoder(new BaseActor());
            $encodePassword = $encoder->encodePassword($actor->getPassword(), $actor->getSalt());
            $actor->setPassword($encodePassword);
            $role = $em->getRepository('CoreBundle:Role')->findOneByRole(Role::USER);
            $actor->addRole($role);
            $em->persist($actor);
            $em->flush();

            $filesData = $request->files->get('actor');
            if (isset($filesData['image']['file']) && $filesData['image']['file'] instanceof UploadedFile) {            
                $this->get('core_manager')->uploadProfileImage($actor);
            }
            
            $this->get('session')->getFlashBag()->add('success', 'actor.created');
            
            return $this->redirectToRoute('core_actor_show', array('id' => $actor->getId()));
        }

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