protected override IEnumerable <SortOrderModel> GetEnumerable() { cats2 = Categories.ToDictionary(t => t.CategoryId); affs2 = Affiliations.ToDictionary(t => t.AffiliationId); var rt = RankCache .Where(a => cats2.ContainsKey(a.CategoryId)) .GroupBy(a => cats2[a.CategoryId].SortOrder) .OrderBy(g => g.Key); foreach (var g in rt) { var prob = new ProblemStatisticsModel[Problems.Length]; for (int i = 0; i < Problems.Length; i++) { prob[i] = new ProblemStatisticsModel(); } yield return(new SortOrderModel(GetViewModel(IsPublic, g, prob), prob)); } }