private IEnumerable <Sitecore.Data.Items.Item> GetChildCategories(Sitecore.Data.Items.Item parentCategory) { if (!parentCategory.IsDerived(Templates.Category.ID)) { return(Enumerable.Empty <Sitecore.Data.Items.Item>()); } var childCategories = GetChildCategoriesFromIndex(parentCategory.ID); if (!childCategories.Any()) { return(GetChildCategories(parentCategory.Parent)); } return(childCategories); }