/**
  * List category trees. The select_node_id request parameter
  * allow to send back the tree where the node belongs with a selected  reef attribute
  *
  * @param Request $request
  *
  * @throws AccessDeniedException
  *
  * @return array
  *
  * @Template
  */
 public function listTreeAction(Request $request)
 {
     if (false === $this->securityFacade->isGranted($this->buildAclName('category_list'))) {
         throw new AccessDeniedException();
     }
     $selectNodeId = $request->get('select_node_id', -1);
     try {
         $selectNode = $this->findCategory($selectNodeId);
     } catch (NotFoundHttpException $e) {
         $selectNode = $this->userContext->getUserCategoryTree($this->rawConfiguration['related_entity']);
     }
     return ['trees' => $this->categoryRepository->getTrees(), 'selectedTreeId' => $selectNode->isRoot() ? $selectNode->getId() : $selectNode->getRoot(), 'include_sub' => (bool) $request->get('include_sub', false), 'item_count' => (bool) $request->get('with_items_count', true), 'related_entity' => $this->rawConfiguration['related_entity']];
 }