public async Task <IApiResponse <TPlainResponse> > SendAsync <TPlainResponse>(Uri uri, ClientRequest request)
            where TPlainResponse : PlainResponse, new()
        {
            Ensure.ArgumentNotNull(uri, "uri");
            Ensure.ArgumentNotNull(request, "request");

            var apiRequest = new ApiRequest(uri, request.GetPlain());

            _authenticator.Apply(apiRequest);

            var response = await ExecuteAsync(apiRequest).ConfigureAwait(false);

            if (!response.IsXml())
            {
                throw new InvalidResponseApiException($"Expected xml content but received '{response.ContentType}'",
                                                      response);
            }

            HandleErrors(response);
            if (!_authenticator.Satisfies(response))
            {
                throw new InvalidResponseApiException("Response signature is invalid", response);
            }

            var apiResponse = _xmlPipeline.Deserialize <TPlainResponse>(response);

            return(apiResponse);
        }
        public async Task <IApiResponse <string> > SendAsync(Uri uri, ClientRequest request)
        {
            Ensure.ArgumentNotNull(uri, "uri");
            Ensure.ArgumentNotNull(request, "request");

            var apiRequest = new ApiRequest(uri, request.GetPlain());

            _authenticator.Apply(apiRequest);

            var response = await ExecuteAsync(apiRequest).ConfigureAwait(false);

            if (!response.IsHtml())
            {
                throw new InvalidResponseApiException($"Expected html content but received '{response.ContentType}'",
                                                      response);
            }

            // nothing to handle: It's always OK 200 and all possible errors are hidden inside of html.
            return(new ApiResponse <string>(response, response.Body));
        }