public function fetchItems(Workspace $workspace, User $user = null, $levelMax = 1)
    {
        $workspaceRoot = $this->finder->get(ResourceNode::class)->find([
            'workspace' => $workspace->getUuid(),
            'parent' => null,
        ])[0];

        $roles = $user ? $user->getRoles() : ['ROLE_ANONYMOUS'];
        $filters = [
            'active' => true,
            'published' => true,
            'hidden' => false,
            'resourceTypeEnabled' => true,
            'workspace' => $workspace->getUuid(),
        ];
        $sortBy = [
            'property' => 'name',
            'direction' => 1,
        ];

        if (!in_array('ROLE_ADMIN', $roles)) {
            $filters['roles'] = $roles;
        }
        // Get all resource nodes available for current user in the workspace
        $visibleNodes = $this->finder->get(ResourceNode::class)->find($filters);
        $filters['parent'] = $workspaceRoot;
        // Get all root resource nodes available for current user in the workspace
        $rootNodes = $this->finder->get(ResourceNode::class)->find($filters, $sortBy);
        $visibleNodesArray = [];
        $childrenNodesArray = [];

        foreach ($visibleNodes as $node) {
            $visibleNodesArray[$node->getUuid()] = $node;

            if ($node->getParent()) {
                $parentId = $node->getParent()->getUuid();

                if (!isset($childrenNodesArray[$parentId])) {
                    $childrenNodesArray[$parentId] = [];
                }
                $childrenNodesArray[$parentId][] = $node;
            }
        }
        $items = [];
        $this->formatNodes($items, $rootNodes, $visibleNodesArray, $childrenNodesArray, $user, $levelMax, 0);

        return $items;
    }