private async Task <ICollection <ServerCache> > LoadServersAsync(CancellationToken cancellationToken)
        {
            var response = await _mWebClient.GetAsync(ServerListUrl, cancellationToken).ConfigureAwait(false);

            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var serverListRaw = XmlConverter.ToClass <ServerSearchResult>(content);

            return(MapToServerListAsync(serverListRaw)
                   .Select(server => new ServerCache(server))
                   .ToList());
        }
        public async Task <AkinatorQuestion> StartNewGame(CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var apiKey = await GetSession(cancellationToken).ConfigureAwait(false);

            var url      = AkiUrlBuilder.NewGame(apiKey, _mServer, _mChildMode);
            var response = await _mWebClient.GetAsync(url, cancellationToken).ConfigureAwait(false);

            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var match = _mRegexStartGameResult.Match(content);

            if (!match.Success && match.Groups.Count != 2)
            {
                throw new ApiErrorException(url, content, "Invalid response while creating new game");
            }

            var result = EnsureNoError <NewGameParameters>(url, match.Groups[1].Value);

            _mSession       = result.Identification.Session;
            _mSignature     = result.Identification.Signature;
            _mStep          = result.StepInformation.Step;
            CurrentQuestion = ToAkinatorQuestion(result.StepInformation);

            return(CurrentQuestion);
        }
        public async Task <AkinatorQuestion> StartNewGame(CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var apiKey = await GetSession(cancellationToken).ConfigureAwait(false);

            var url      = AkiUrlBuilder.NewGame(apiKey, m_server, m_childMode);
            var response = await m_webClient.GetAsync(url, cancellationToken).ConfigureAwait(false);

            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var match = m_regexStartGameResult.Match(content);

            if (!match.Success && match.Groups.Count != 2)
            {
                throw new InvalidCastException($"Invalid result received from Akinator. Result was {response}");
            }

            var result = JsonConvert.DeserializeObject <BaseResponse <NewGameParameters> >(match.Groups[1].Value,
                                                                                           new JsonSerializerSettings
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });

            m_session       = result.Parameters.Identification.Session;
            m_signature     = result.Parameters.Identification.Signature;
            m_step          = result.Parameters.StepInformation.Step;
            CurrentQuestion = ToAkinatorQuestion(result.Parameters.StepInformation);
            return(ToAkinatorQuestion(result.Parameters.StepInformation));
        }