/**
  * @param Request $request
  * @param Resource $resource
  * @return RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function editAction(Request $request, Resource $resource, Resource $parent = null)
 {
     /** @var \Bigfish\Bundle\EavBundle\Entity\Module $module */
     $module = $resource->getModule();
     $persister = $this->container->get("bigfish.resource.persister");
     $container = $persister->loadModel($module, $resource);
     /**  @var \Symfony\Component\Form\Form $form **/
     $form = $this->get("eav.form.builder")->createFormBuilder($module, array("container" => $container))->getForm();
     $parent_id = $parent ? $parent->getId() : 0;
     if ($this->formHandler->handleUpdate($form, $request, $resource)) {
         return $this->redirect($this->generateUrl('resource_index', array('template' => $resource->getTemplate()->getId(), "parent" => $parent_id)));
     }
     //        var_dump($this->getFormErrors($form));
     return $this->render("BigfishResourceBundle:Resource:edit.html.twig", array('form' => $form->createView(), 'actionUrl' => $this->generateUrl('resource_edit', array('resource' => $resource->getId(), "parent" => $parent_id))));
 }