private IEnumerable <NavigationItemModel> GetRightNavListItems(PageData currentPage, int minLevel, Type[] pageTypes) { var pageLevel = currentPage.GetLevel(); var result = new List <NavigationItemModel>(); if (pageLevel < minLevel) { return(result); } var childrenOfCurrPage = _groContentDataService.GetChildrenForVisitor <SitePageBase>(currentPage, HttpContext); IEnumerable <SitePageBase> listSiblingsAtRootLevel; if (childrenOfCurrPage.Any() || pageLevel <= 4) { //This page will be the one of main nav item together with its siblings. listSiblingsAtRootLevel = _groContentDataService.GetSiblingsForVisitor <SitePageBase>(currentPage, HttpContext); } else { // this page is the leaf, go up ,find its parent var parentPage = _contentRepository.Get <PageData>(currentPage.ParentLink); listSiblingsAtRootLevel = _groContentDataService.GetSiblingsForVisitor <SitePageBase>(parentPage ?? currentPage, HttpContext); } if (pageTypes != null) { listSiblingsAtRootLevel = listSiblingsAtRootLevel .Where(page => pageTypes.Any(type => type.IsInstanceOfType(page))); } result.AddRange(listSiblingsAtRootLevel.Select(page => new NavigationItemModel { ContentLink = page.ContentLink, IsActive = page.ContentGuid == currentPage.ContentGuid, Text = page.Name, Children = _groContentDataService .GetChildrenForVisitor <SitePageBase>(page, HttpContext) .Select(x => CreateNavItem(x, currentPage)) })); return(result); }