public MatchBreakdown GetMatch(long gameId, string region, string accountId)
        {
            var pathBuilder = new UrlPathBuilder();

            using (var client = new HttpClient())
            {
                try
                {
                    client.DefaultRequestHeaders.Add("X-Riot-Token", ConfigWrapper.ApiKey);
                    var response = client.GetAsync(new Uri(pathBuilder.GetMatchByGameIdUrl(gameId, region)));
                    response.Wait();

                    if (response.Result.IsSuccessStatusCode)
                    {
                        var readData = response.Result.Content.ReadAsStringAsync();
                        readData.Wait();

                        var match     = JsonConvert.DeserializeObject <Match>(readData.Result);
                        var breakdown = SummonerInfoUtils.GetMatchBreakdown(match, region, accountId);

                        return(breakdown);
                    }
                }
                catch (Exception) { return(new MatchBreakdown()); }
            }
            return(new MatchBreakdown());
        }
        private MatchHistory GetMatchHistoryOfSummoner(string accountId, string region, int?startIndex = null, int?endIndex = null)
        {
            var pathBuilder  = new UrlPathBuilder();
            var matchHistory = new MatchHistory();
            var matchList    = new MatchList();

            if (startIndex.HasValue && endIndex.HasValue)
            {
                matchList = GetMatchListOfSummoner(accountId, region, startIndex.Value, endIndex.Value);
            }
            else
            {
                matchList = GetMatchListOfSummoner(accountId, region);
            }

            using (var client = new HttpClient())
            {
                try
                {
                    client.DefaultRequestHeaders.Add("X-Riot-Token", ConfigWrapper.ApiKey);
                    foreach (var matchRef in matchList.Matches)
                    {
                        var response = client.GetAsync(new Uri(pathBuilder.GetMatchByGameIdUrl(matchRef.GameId, region)));
                        response.Wait();

                        var result = response.Result;
                        if (result.IsSuccessStatusCode)
                        {
                            var readData = result.Content.ReadAsStringAsync();
                            readData.Wait();

                            var match = JsonConvert.DeserializeObject <Match>(readData.Result);
                            foreach (var participant in match.Participants)
                            {
                                SummonerInfoUtils.SetParticipantCustomFields(participant, match, readData.Result);
                            }

                            SummonerInfoUtils.SetMatchCustomFields(match, accountId, matchRef);
                            matchHistory.Matches.Add(match);
                        }
                    }
                }
                catch (Exception) {}
            }
            return(matchHistory);
        }