protected function generateTree(Collection $collection, Collection $children)
    {
        $children->map(function (AdminMenuInterface $menuItem) use ($collection, &$tree) {
            $tree[] = [
                'routeName' => $menuItem->getRouteName(),
                'cssClass'  => $menuItem->getCssClass(),
                'name'      => $menuItem->getName(),
                'children'  => $this->generateTree($collection, $this->filterElements($collection, $menuItem))
            ];
        });
        
        return $tree;
    }