private static IEnumerable <MatchEvent> ConvertTimeEventsDtoToTimelineEvents(
            IEnumerable <MatchEventDto> matchEventDtoList)
        {
            if (matchEventDtoList == null)
            {
                return(new List <MatchEvent>());
            }

            try
            {
                var matchEventList = new List <MatchEvent>();

                foreach (var matchEventDto in matchEventDtoList)
                {
                    matchEventList.Add(new MatchEvent
                    {
                        Type                  = matchEventDto.Type,
                        TimeStamp             = matchEventDto.Timestamp,
                        UserFriendlyTimestamp = TimeSpanUtils.ConvertTimespanToFriendly(Convert.ToInt32(matchEventDto.Timestamp.TotalSeconds)),
                        ParticipantId         = matchEventDto.ParticipantId,
                        ItemId                = matchEventDto.ItemId,
                        SkillSlot             = matchEventDto.SkillSlot,
                        LevelUpType           = matchEventDto.LevelUpType,
                        WardType              = matchEventDto.WardType,
                        CreatorId             = matchEventDto.CreatorId,
                        KillerId              = matchEventDto.KillerId,
                        VictimId              = matchEventDto.VictimId,
                        AfterId               = matchEventDto.AfterId,
                        BeforeId              = matchEventDto.BeforeId,
                        TeamId                = matchEventDto.TeamId,
                        BuildingType          = matchEventDto.BuildingType,
                        LaneType              = matchEventDto.LaneType,
                        TowerType             = matchEventDto.TowerType,
                        MonsterType           = matchEventDto.MonsterType,
                        MonsterSubType        = matchEventDto.MonsterSubType
                    });
                }

                return(matchEventList);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception caught when converting list of MatchEventDto to list of MatchEvent : " + e.Message);
            }

            return(new List <MatchEvent>());
        }
        public static Match ConverMatchDtoToMatch(MatchDto matchDto, MatchTimelineDto matchTimelineDto)
        {
            if (matchDto == null || matchTimelineDto == null)
            {
                return(new Match());
            }

            try
            {
                return(new Match
                {
                    GameDuration = TimeSpanUtils.ConvertTimespanToFriendly(Convert.ToInt32(matchDto.GameDuration.TotalSeconds)),
                    GameDate = matchDto.GameDate,
                    GamePatch = matchDto.GamePatch,
                    WinningTeamId = matchDto.WinningTeamId,

                    TeamOne = ConvertMatchTeamDtoToMatchTeam
                              (
                        matchDto.Teams.ElementAtOrDefault(0),
                        matchTimelineDto.Events
                              ),

                    TeamTwo = ConvertMatchTeamDtoToMatchTeam
                              (
                        matchDto.Teams.ElementAtOrDefault(1),
                        matchTimelineDto.Events
                              )
                });
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception caught converting MatchDto to Match : " + e.Message);
            }

            return(new Match());
        }