/// <summary>
        /// Asynchronously gets the response for this request.
        /// </summary>
        /// <returns>The response message.</returns>
        /// <remarks>
        /// This method is not part of the IODataRequestMessage interface. It's here to make the usage of these classes easier.
        /// Each implementation of the interfaces is expected to provide its own way to create the instances and or get them somewhere.
        /// </remarks>
        public async Task <IODataResponseMessageAsync> GetResponseAsync()
        {
            WebException webException;

            try
            {
                HttpWebResponse webResponse = (HttpWebResponse)(await this.webRequest.GetResponseAsync());
                return(new ClientHttpResponseMessage(webResponse));
            }
            catch (WebException exception)
            {
                webException = exception;
            }

            if (webException.Response != null)
            {
                // If there is an error response, try to read it.
                IODataResponseMessageAsync errorResponseMessage = new ClientHttpResponseMessage((HttpWebResponse)webException.Response);
                using (ODataMessageReader messageReader = new ODataMessageReader(errorResponseMessage))
                {
                    // The payload kind detection will determine if the payload is an error by looking at the content type (and possibly even the payload).
                    if ((await messageReader.DetectPayloadKindAsync()).Any(payloadKindDetectionResult => payloadKindDetectionResult.PayloadKind == ODataPayloadKind.Error))
                    {
                        // Construct the error message by concatenating all the error messages (including the inner ones).
                        // Makes it easier to debug problems.
                        ODataError error = await messageReader.ReadErrorAsync();

                        // If it is an error throw the ODataErrorException, it's easier to recognize and also read.
                        throw new ODataErrorException(CreateODataErrorExceptionMessage(error), error);
                    }
                }
            }

            throw webException;
        }