public DateSnapshotInfo GetForDate(DateTime dateFor)
        {
            var resultForDate = new DateSnapshotInfo
            {
                Date       = dateFor,
                Collection = CollectionByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <int, int>(),
                //Decks = DecksByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new ConfigModelRawDeck[0],
                Inventory              = InventoryByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Inventory(),
                Matches                = MatchesByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new MatchResult[0],
                RankSynthetic          = RankSyntheticByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new ConfigModelRankInfo[0],
                PlayerProgress         = PlayerProgressByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <string, PlayerProgress>(),
                PlayerProgressIntraday = PlayerProgressIntradayByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, GetPlayerProgressRaw>(),
                InventoryUpdates       = InventoryUpdatesByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, InventoryUpdatedRaw>(),
                PostMatchUpdates       = PostMatchUpdatesByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, PostMatchUpdateRaw>(),
                PlayerQuests           = PlayerQuestsByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new PlayerQuest[0],
                //CrackedBoosters = CrackedBoostersByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary<DateTime, CrackBoosterRaw>(),
                //DraftPickProgress = DraftPickProgressByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new DraftMakePickRaw[0],
                DraftPickProgressIntraday = DraftPickProgressIntradayByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, DraftMakePickRaw>(),
                MtgaDecksFound            = MtgaDecksFoundByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new HashSet <string>(),
                //VaultsOpened = VaultsOpenedByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary<DateTime, CompleteVaultRaw>(),
                //CollectionIntraday = CollectionIntradayByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary<DateTime, Dictionary<int, int>>(),
                InventoryIntraday = InventoryIntradayByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, Inventory>(),
                CombinedRankInfo  = CombinedRankInfoByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, GetCombinedRankInfoRaw>(),
                EventClaimPrize   = EventClaimPriceByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, EventClaimPrizeRaw>(),
                //PayEntry = PayEntryByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary<DateTime, PayEntryRaw>(),
                RankUpdated = RankUpdatedByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, RankUpdatedRaw>(),
                //MythicRatingUpdated = MythicRatingUpdatedByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary<DateTime, MythicRatingUpdatedRaw>(),
            };

            //var diff = DiffByDate.GetData().SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new DateSnapshotDiff();

            //return (resultForDate, diff);
            return(resultForDate);
        }
        public ICollection <DateSnapshotInfo> BuildHistory()
        {
            var result = new List <DateSnapshotInfo>();

            Func <DateTime, DateSnapshotInfo> CreateOrGetDateSnapshotInfo = (date) =>
            {
                var dateOnly = date.Date;
                var info     = result.FirstOrDefault(i => i.Date == dateOnly);
                if (info == null)
                {
                    info = new DateSnapshotInfo(dateOnly);
                    result.Add(info);
                }

                return(info);
            };

            //foreach (var dataType in Data.Keys)
            //{
            //    foreach (var data in Data[dataType].GetData())
            //        CreateOrGetDateSnapshotInfo(data.DateTime).
            //}

            foreach (var collection in CollectionByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(collection.DateTime).Collection = collection.Info;
            }

            foreach (var inventory in InventoryByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(inventory.DateTime).Inventory = inventory.Info;
            }

            foreach (var progress in PlayerProgressByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(progress.DateTime).PlayerProgress = progress.Info;
            }

            foreach (var progress in PlayerProgressIntradayByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(progress.DateTime).PlayerProgressIntraday = progress.Info;
            }

            foreach (var matches in MatchesByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(matches.DateTime).Matches = matches.Info;
            }

            foreach (var quests in PlayerQuestsByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(quests.DateTime).PlayerQuests = quests.Info;
            }

            //foreach (var boosters in CrackedBoostersByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(boosters.DateTime).CrackedBoosters = boosters.Info;

            foreach (var rankInfo in RankSyntheticByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(rankInfo.DateTime).RankSynthetic = rankInfo.Info;
            }

            foreach (var inventoryUpdate in InventoryUpdatesByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(inventoryUpdate.DateTime).InventoryUpdates = inventoryUpdate.Info;
            }

            foreach (var postMatchUpdate in PostMatchUpdatesByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(postMatchUpdate.DateTime).PostMatchUpdates = postMatchUpdate.Info;
            }

            //foreach (var draftPicks in DraftPickProgressByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(draftPicks.DateTime).DraftPickProgress = draftPicks.Info;

            foreach (var draftPicks in DraftPickProgressIntradayByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(draftPicks.DateTime).DraftPickProgressIntraday = draftPicks.Info;
            }

            //foreach (var payEntry in PayEntryByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(payEntry.DateTime).PayEntry = payEntry.Info;

            //foreach (var mythicRatingUpdated in MythicRatingUpdatedByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(mythicRatingUpdated.DateTime).MythicRatingUpdated = mythicRatingUpdated.Info;

            foreach (var combinedRankInfo in CombinedRankInfoByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(combinedRankInfo.DateTime).CombinedRankInfo = combinedRankInfo.Info;
            }

            foreach (var rankUpdated in RankUpdatedByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(rankUpdated.DateTime).RankUpdated = rankUpdated.Info;
            }

            foreach (var eventClaimPrice in EventClaimPriceByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(eventClaimPrice.DateTime).EventClaimPrize = eventClaimPrice.Info;
            }

            foreach (var mtgaDecksfound in MtgaDecksFoundByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(mtgaDecksfound.DateTime).MtgaDecksFound = mtgaDecksfound.Info;
            }

            //foreach (var vaultsOpened in VaultsOpenedByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(vaultsOpened.DateTime).VaultsOpened = vaultsOpened.Info;

            //foreach (var collectionIntraday in CollectionIntradayByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(collectionIntraday.DateTime).CollectionIntraday = collectionIntraday.Info;

            foreach (var inventoryIntraday in InventoryIntradayByDate.GetData())
            {
                CreateOrGetDateSnapshotInfo(inventoryIntraday.DateTime).InventoryIntraday = inventoryIntraday.Info;
            }

            //foreach (var decks in DecksByDate.GetData())
            //    CreateOrGetDateSnapshotInfo(decks.DateTime).Decks = decks.Info;

            //ICollection<ConfigModelRankInfo> previousRank = null;
            foreach (var s in result)
            {
                //s.Wins = s.Matches.Count(i => i.Outcome == GameOutcomeEnum.Victory);
                //s.Losses = s.Matches.Count(i => i.Outcome == GameOutcomeEnum.Defeat);
                s.OutcomesByMode = s.Matches
                                   .GroupBy(i => i.EventName)
                                   .ToDictionary(i => i.Key, i => new Outcomes
                {
                    Wins   = i.Count(x => x.Outcome == GameOutcomeEnum.Victory),
                    Losses = i.Count(x => x.Outcome == GameOutcomeEnum.Defeat),
                });

                //s.ConstructedRank = (s.RankInfo.FirstOrDefault(i => i.Format == ConfigModelRankInfoFormatEnum.Constructed) ??
                //                    previousRank?.FirstOrDefault(i => i.Format == ConfigModelRankInfoFormatEnum.Constructed))?.ToString() ?? "N/A";
                //s.LimitedRank = (s.RankInfo.FirstOrDefault(i => i.Format == ConfigModelRankInfoFormatEnum.Limited) ??
                //                    previousRank?.FirstOrDefault(i => i.Format == ConfigModelRankInfoFormatEnum.Limited))?.ToString() ?? "N/A";

                //previousRank = s.RankInfo;
            }

            return(result);
        }