public IActionResult ThreadsPerMonth() { var threads = _threadService.FindAllNoTracking(); return(Ok(threads.GroupBy(x => new DateTime(x.DateCreated.Value.Year, x.DateCreated.Value.Month, 1)) .Select(x => new { Key = new { x.Key.Year, x.Key.Month }, Value = x.Count() }).OrderBy(x => x.Key.Year).ThenBy(x => x.Key.Month))); }