/**
  * @Route("/book/create/module", name="book-create-module")
  */
 public function createModuleAction(Request $request)
 {
     $entityManager = $this->getDoctrine()->getManager();
     $moduleData = $request->get('module');
     $book = $entityManager->getRepository('eTextBookLoungeBundle:Book')->findOneBySlug($moduleData['bookSlug']);
     $package = new BookPackage($book);
     $package->setTemplateFolderPath($this->container->getParameter('book_template_dir'));
     $package->setTmpFolderPath($this->container->getParameter('book_tmp_dir'));
     $package->setBooksFolderPath($this->container->getParameter('books_dir'));
     $package->updateBookSlug();
     $moduleSlug = $package->addModule($moduleData['title']);
     $package->pack();
     $response = array('status' => 'success', 'data' => array('slug' => $moduleSlug));
     return new JsonResponse($response);
 }