private Dictionary <DateTime, long> GetTimelineStats([NotNull] CSRedisClient redis, [NotNull] string type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } var endDate = DateTime.UtcNow.Date; var startDate = endDate.AddDays(-7); var dates = new List <DateTime>(); while (startDate <= endDate) { dates.Add(endDate); endDate = endDate.AddDays(-1); } var keys = dates.Select(x => _storage.GetRedisKey($"stats:{type}:{x:yyyy-MM-dd}")).ToArray(); var valuesMap = redis.GetValuesMap(keys); var result = new Dictionary <DateTime, long>(); for (var i = 0; i < dates.Count; i++) { long value; if (!long.TryParse(valuesMap[valuesMap.Keys.ElementAt(i)], out value)) { value = 0; } result.Add(dates[i], value); } return(result); }