/**
  * Remove category tree
  *
  * @param integer $id
  *
  * @AclAncestor("pim_enrich_category_remove")
  * @return RedirectResponse
  */
 public function removeAction($id)
 {
     $category = $this->findCategory($id);
     $parent = $category->getParent();
     $params = $parent !== null ? array('node' => $parent->getId()) : array();
     $this->categoryManager->remove($category);
     foreach ($this->doctrine->getManagers() as $manager) {
         $manager->flush();
     }
     if ($this->getRequest()->isXmlHttpRequest()) {
         return new Response('', 204);
     } else {
         return $this->redirectToRoute('pim_enrich_categorytree_create', $params);
     }
 }