private async Task <Db_LccCachedTeamInformation> CreateCachedTeamInformationFromRiotMatch(RiotSharp.Endpoints.MatchEndpoint.Match match, IEnumerable <Participant> teamParticipants, Timeline timeline, int teamId)
        {
            Db_LccCachedTeamInformation teamInformation = new Db_LccCachedTeamInformation
            {
                TotalKills      = teamParticipants.Sum(x => x.Stats.Kills),
                TotalDeaths     = teamParticipants.Sum(x => x.Stats.Kills),
                TotalAssists    = teamParticipants.Sum(x => x.Stats.Kills),
                DragonKills     = match.Teams.FirstOrDefault(x => x.TeamId == teamId).DragonKills,
                BaronKills      = match.Teams.FirstOrDefault(x => x.TeamId == teamId).BaronKills,
                RiftHeraldKills = match.Teams.FirstOrDefault(x => x.TeamId == teamId).RiftHeraldKills,
                InhibitorKills  = match.Teams.FirstOrDefault(x => x.TeamId == teamId).InhibitorKills
            };

            teamInformation.Players = new List <Db_LccCachedPlayerStats>();
            foreach (Participant participant in teamParticipants)
            {
                ParticipantIdentity participantIdentity = match.ParticipantIdentities.FirstOrDefault(x => x.ParticipantId == participant.ParticipantId);
                teamInformation.Players.Add(await
                                            CreateCachedPlayerStatsFromMatchupInfo
                                            (
                                                participantIdentity,
                                                participant,
                                                timeline
                                            )
                                            );
            }

            return(teamInformation);
        }
        //Method triggered when a match is requested that we don't currently have in the cache
        public async Task <Db_LccCachedCalculatedMatchupInfo> CreateDatabaseModelForCalculatedMatchupInfo(RiotSharp.Endpoints.MatchEndpoint.Match match, Timeline timeline, long usersChampionId)
        {
            try
            {
                int usersTeamId = match.Participants.FirstOrDefault(x => x.ChampionId == usersChampionId).TeamId;

                IEnumerable <Participant> friendlyTeamParticipants = match.Participants.Where(x => x.TeamId == usersTeamId);
                IEnumerable <Participant> enemyTeamParticipants    = match.Participants.Where(x => x.TeamId != usersTeamId);

                Db_LccCachedCalculatedMatchupInfo cachedMatchupInformation = new Db_LccCachedCalculatedMatchupInfo()
                {
                    GameId          = match.GameId,
                    MatchDate       = match.GameCreation,
                    MatchPatch      = match.GameVersion,
                    MatchDuration   = match.GameDuration,
                    FriendlyTeamWin = match.Teams.FirstOrDefault(x => x.TeamId == usersTeamId).Win == MatchOutcome.Win
                };

                cachedMatchupInformation.FriendlyTeam = await
                                                        CreateCachedTeamInformationFromRiotMatch
                                                        (
                    match,
                    match.Participants.Where(x => x.TeamId == usersTeamId),
                    timeline,
                    match.Participants.FirstOrDefault(x => x.ChampionId == usersChampionId).TeamId
                                                        );

                cachedMatchupInformation.EnemyTeam = await
                                                     CreateCachedTeamInformationFromRiotMatch
                                                     (
                    match,
                    match.Participants.Where(x => x.TeamId != usersTeamId),
                    timeline,
                    match.Participants.FirstOrDefault(x => x.ChampionId != usersChampionId).TeamId
                                                     );

                return(cachedMatchupInformation);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error when creating dbmodel for cached matchup info.");
            }

            return(new Db_LccCachedCalculatedMatchupInfo());
        }