protected List <WebsiteMenuModel> GetCategoryMenuOrdered(int parentID, bool includeAllSubMenus = false, ProductType type = ProductType.Item) { var menu = new List <WebsiteMenuModel>(); List <tbl_ProdCategories> allCats = ECommerceService.GetProdCategoriesForDomain(this.DomainID, parentID, false, type); foreach (var item in allCats) { var content = item.tbl_SiteMap.tbl_Content.Where(c => c.C_Approved && !c.C_Deleted).OrderByDescending(c => c.C_ModificationDate).FirstOrDefault(); string url = ""; if (type == ProductType.Item) { url = String.Format("/{0}{1}", this.Domain.DO_CustomRouteHandler ? string.Empty : WebContentService.GetSitemapUrlByType(SiteMapType.ProductShop, this.DomainID).Trim('/'), item.tbl_SiteMap.SM_URL); } else if (type == ProductType.Event) { url = String.Format("/{0}{1}", this.Domain.DO_CustomRouteHandler ? string.Empty : WebContentService.GetSitemapUrlByType(SiteMapType.EventShop, this.DomainID).Trim('/'), item.tbl_SiteMap.SM_URL); } if (content != null) { menu.Add(new WebsiteMenuModel { Name = content.C_MenuText, Url = url, Title = content.C_Title, ModificationDate = content.C_ModificationDate, Priority = item.tbl_SiteMap.SM_Priority.GetValueOrDefault((decimal)0.5), SubMenuItems = GetCategoryMenuOrdered(item.CategoryID, includeAllSubMenus, type) }); } } return(menu); }