public static List <ResourceCount> MonthlyVisitors(SiteDb sitedb) { var allweeks = sitedb.LogWeekNames(); var lastfour = allweeks.OrderByDescending(o => o).Take(4); List <ResourceCount> monthly = new List <ResourceCount>(); List <VisitorLog> logs = new List <VisitorLog>(); foreach (var item in lastfour) { logs.AddRange(GetLogs(sitedb, item)); } var groupby = logs.GroupBy(o => GetDayString(o.Begin)); foreach (var item in groupby) { ResourceCount resouce = new ResourceCount(); resouce.Name = item.Key; resouce.Count = item.Count(); monthly.Add(resouce); } return(monthly.OrderBy(o => o.Name).ToList()); }