public IDictionary <string, double> GetMostAverageTimeSpentPage() { int numOfPages = BusinessRuleConstants.GetMostAverageTimeSpentPage_NumOfPage; // 5 IDictionary <string, double> pageTime = _dashboardService.CountAverageTimeSpentPage(); IDictionary <string, double> average = new Dictionary <string, double>(); var pageTimeSorted = from page in pageTime orderby page.Value descending select(page.Key, page.Value); pageTimeSorted = pageTimeSorted.Take(numOfPages); // add an item into the dictionary foreach (var pageNum in pageTimeSorted) { average.Add(pageNum.Key, pageNum.Value); } return(average); }