/// <summary>
        /// Resource owner password credentials grant
        /// (Section 4.3 of OAuth2 Draft spec)
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public ProxyResponse<OAuthAuthorisationGrantResponse> PasswordCredentialsGrantRequest(string username, string password, string scope = "")
        {
            var result = new OAuthAuthorisationGrantResponse();

            ContentType = RequestContentType.ApplicationJson;
            var postBody = new OAuthPasswordCredentialsGrantRequest { grant_type = "password", password = password, username = username, scope = scope };
            //var uri = base.GetRequestUri(string.Format("?grant_type=password&username={0}&password={1}&scope={2}",username,password,scope));
            var uri = base.GetRequestUri("token");
            var response = GetResponse(uri, postBody);
            if (response.IsSuccessfull)
            {
                try
                {
                    JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                    var dto = jsonSerializer.Deserialize<OAuthAccessTokenGrant>(response.RawResponse);
                    result.IsSuccessfull = true;
                    result.AccessGrant = dto;
                }
                catch
                {
                    JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                    var dto = jsonSerializer.Deserialize<OAuthGrantRequestError>(response.RawResponse);
                    result.IsSuccessfull = false;
                    result.ErrorDetails = dto;
                }
            }
            else
            {
                result.IsSuccessfull = false;
            }

            var statusCode = result.IsSuccessfull ? HttpStatusCode.OK : HttpStatusCode.Unauthorized;
            return new ProxyResponse<OAuthAuthorisationGrantResponse>(response.RawResponse, result, result.IsSuccessfull, statusCode, string.Empty);
        }
        public ProxyResponse<OAuthAuthorisationGrantResponse> RefreshAccessToken(string refreshToken, string scope)
        {
            var result = new OAuthAuthorisationGrantResponse();
            OperationMethod = HttpMethod.Post;

            ContentType = RequestContentType.ApplicationJson;
            var uri = base.GetRequestUri("refresh");
            var postBody = new OAuthRefreshAccessTokenRequest { grant_type = "refresh_token", refresh_token = refreshToken, scope = scope };
            var response = GetResponse(uri, postBody);

            if (response.IsSuccessfull)
            {
                try
                {
                    JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                    var dto = jsonSerializer.Deserialize<OAuthAccessTokenGrant>(response.RawResponse);
                    result.IsSuccessfull = true;
                    result.AccessGrant = dto;
                }
                catch
                {
                    JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                    var dto = jsonSerializer.Deserialize<OAuthGrantRequestError>(response.RawResponse);
                    result.IsSuccessfull = false;
                    result.ErrorDetails = dto;
                }
            }
            else
            {
                result.IsSuccessfull = false;
            }

            var statusCode = result.IsSuccessfull ? HttpStatusCode.OK : HttpStatusCode.Unauthorized;
            return new ProxyResponse<OAuthAuthorisationGrantResponse>(response.RawResponse, result, result.IsSuccessfull, statusCode, string.Empty);
        }