/**
  * Move a node
  *
  * @param Request $request
  *
  * @throws AccessDeniedException
  *
  * @return Response
  */
 public function moveNodeAction(Request $request)
 {
     if (false === $this->securityFacade->isGranted($this->buildAclName('category_edit'))) {
         throw new AccessDeniedException();
     }
     $category = $this->findCategory($request->get('id'));
     $parent = $this->findCategory($request->get('parent'));
     $category->setParent($parent);
     $prevSiblingId = $request->get('prev_sibling');
     if (!empty($prevSiblingId)) {
         $prevSibling = $this->categoryRepository->find($prevSiblingId);
     }
     if (is_object($prevSibling)) {
         $this->categoryRepository->persistAsNextSiblingOf($category, $prevSibling);
     } else {
         $this->categoryRepository->persistAsFirstChildOf($category, $parent);
     }
     return new JsonResponse(['status' => 1]);
 }