/**
  * Builds NavigationItem's from given root pages.
  *
  * @param PageModel[] $rootPages
  *
  * @return NavigationItem[]
  *
  * @throws \RuntimeException if multiple root pages have the same language
  */
 private function createNavigationItemsForRootPages(array $rootPages)
 {
     $navigationItems = [];
     foreach ($rootPages as $rootPage) {
         if (!$this->isPagePublished($rootPage)) {
             continue;
         }
         $language = strtolower($rootPage->language);
         if (array_key_exists($language, $navigationItems)) {
             throw new \RuntimeException(sprintf('Multiple root pages for the language "%s" found', $rootPage->language));
         }
         $navigationItems[$language] = new NavigationItem($rootPage, $this->languageText->get($language));
     }
     return $navigationItems;
 }