public function newNodeAction($treeId, $versionId)
 {
     // build
     $return = $this->build($treeId, $versionId);
     if (!$this->treeVersionEditable) {
         throw new AccessDeniedException();
     }
     //data
     $form = $this->createForm(new AdminNodeNewType());
     $request = $this->getRequest();
     if ($request->getMethod() == 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $doctrine = $this->getDoctrine()->getManager();
             $node = new Node();
             $node->setTreeVersion($this->treeVersion);
             $node->setTitleAdmin($form->get('titleAdmin')->getData());
             $node->setTitlePreviousAnswers($form->get('titlePreviousAnswers')->getData());
             $node->setTitle($form->get('title')->getData());
             $node->setBodyText($form->get('body_text')->getData());
             $node->setBodyHTML($form->get('body_html')->getData());
             $doctrine->persist($node);
             $doctrine->flush();
             // If this is first node on a tree version, make it the starting node now.
             $doctrine = $this->getDoctrine()->getManager();
             $nodeRepo = $doctrine->getRepository('QuestionKeyBundle:Node');
             if ($nodeRepo->getCountNodesForTreeVersion($this->treeVersion) == 1) {
                 $startingNodeRepo = $doctrine->getRepository('QuestionKeyBundle:TreeVersionStartingNode');
                 $startingNodeRepo->setAsStartingNode($node);
             }
             return $this->redirect($this->generateUrl('questionkey_admin_tree_version_node_show', array('treeId' => $this->tree->getPublicId(), 'versionId' => $this->treeVersion->getPublicId(), 'nodeId' => $node->getPublicId())));
         }
     }
     return $this->render('QuestionKeyBundle:AdminTreeVersionEdit:newNode.html.twig', array('tree' => $this->tree, 'treeVersion' => $this->treeVersion, 'form' => $form->createView()));
 }