protected function isPageEmpty(AbstractPage $page)
    {
        if ($page->get('route')) {
            return false;
        }
        
        if (!$page->hasPages(true)) {
            return true;
        }
        
        $isGranted = $this->getView()->plugin('isGranted');
        foreach ($page->getPages() as $childPage) {
            if (!$childPage->isVisible()) {
                continue;
            }
            
            if ($isGranted($childPage->get('permission'))) {
                return false;
            }
        }
        
        return true;
    }