public void OnGet() { var locationDates = _orderStorage.All.Where(o => o.LocationId.HasValue) .Select(o => new { OrderDate = _timeZone.GetTimeZoneCorrectedDate(o.CreatedAt.Value), o.LocationId }) .ToArray(); Locations = new Dictionary <string, DateTime[]>(); foreach (var location in _shopifyLocationStorage.All) { var dates = locationDates.Where(ld => ld.LocationId == location.Id) .Select(o => o.OrderDate).Distinct().OrderBy(d => d).ToArray(); Locations[location.Name] = dates; } }