public static IList<CalendarData> MapToCalendarDataList(this IList<DayInfo> dataRows)
{
if (dataRows == null || !dataRows.Any())
return null;
var rows = dataRows.OrderBy(x => x.Year).ThenBy(x => x.Month);
return rows.GroupBy(x =>
new
{
Year = x.Year,
Month = x.Month
})
.Select(x => new CalendarData
{
Month = x.Key.Month,
Year = x.Key.Year,
MonthDaysInfo = x.ToList()
})
.ToList();
}