LogResponse() private method

private LogResponse ( HyvesResponse response ) : void
response HyvesResponse
return void
        /// <summary>
        /// Completes an asynchronous call to invoke an API method.
        /// </summary>
        /// <param name="asyncResult">The async result from the corresponding BeginCreateAccessToken call.</param>
        /// <returns>The resulting response.</returns>
        public HyvesResponse EndInvokeMethod(IAsyncResult asyncResult)
        {
            if (asyncRequest == null)
            {
                throw new InvalidOperationException("No method is currently being invoked using this request.");
            }

            HyvesResponse response = null;

            try
            {
                HttpWebResponse webResponse = (HttpWebResponse)asyncRequest.EndGetResponse(asyncResult);
                if (webResponse.StatusCode != HttpStatusCode.OK)
                {
                    response = new HyvesResponse(webResponse.StatusCode, asyncMethod);
                }
                else
                {
                    Stream responseStream = webResponse.GetResponseStream();
                    response = new HyvesResponse(responseStream, asyncMethod);
                }
            }
            finally
            {
                asyncRequest = null;
                asyncMethod  = HyvesMethod.Unknown;
            }

            session.LogResponse(response);
            return(response);
        }