/// <summary>
        /// Invokes HDC service with the specified options
        /// </summary>
        /// <param name="method">HTTP method to use</param>
        /// <param name="uri">URI of the service to invoke</param>
        /// <param name="input">Options for the new artifact to be generated</param>
        /// <param name="isMany">Whether the result has a single entity or multiple</param>
        /// <returns>Dev Center response with either an error or an artifact if created/queried successfully</returns>
        public async Task <DevCenterResponse <Output> > InvokeHdcService <Output>(
            HttpMethod method, string uri, object input, bool isMany) where Output : IArtifact
        {
            DevCenterResponse <Output> retval = new DevCenterResponse <Output>();

            retval.Error = await InvokeHdcService(method, uri, input, (content) =>
            {
                if (isMany)
                {
                    Response <Output> ret = JsonConvert.DeserializeObject <Response <Output> >(content);
                    retval.ReturnValue    = ret.Value;
                }
                else
                {
                    Output ret = JsonConvert.DeserializeObject <Output>(content);
                    if (ret.Id != null)
                    {
                        retval.ReturnValue = new List <Output> {
                            ret
                        };
                    }
                }
            });

            return(retval);
        }
        /// <summary>
        /// Requests creation of driver metadata on older submissions to HWDC
        /// </summary>
        /// <returns>Dev Center response with either an error or ok if metadata was created successfully</returns>
        public async Task <DevCenterResponse <bool> > CreateMetaData(string productId, string submissionId)
        {
            string createMetaDataUrl = GetDevCenterBaseUrl() +
                                       string.Format(DevCenterCreateMetaDataUrl, Uri.EscapeDataString(productId), Uri.EscapeDataString(submissionId));
            DevCenterErrorDetails error = await InvokeHdcService(HttpMethod.Post, createMetaDataUrl, null, null);

            DevCenterResponse <bool> ret = new DevCenterResponse <bool>()
            {
                Error       = error,
                ReturnValue = new List <bool>()
                {
                    error == null
                }
            };

            return(ret);
        }
        /// <summary>
        /// Requests cancellation of a shipping label
        /// </summary>
        /// <returns>Dev Center Response with Boolean value indicating a successful call to cancel a the shipping label</returns>
        public async Task <DevCenterResponse <bool> > CancelShippingLabel(string productId, string submissionId, string shippingLabelId)
        {
            string cancelShippingLabelUrl = GetDevCenterBaseUrl() +
                                            string.Format(DevCenterCancelShippingLabelUrl, productId, submissionId, shippingLabelId);

            DevCenterErrorDetails error = await InvokeHdcService(HttpMethod.Put, cancelShippingLabelUrl, null, null);

            DevCenterResponse <bool> ret = new DevCenterResponse <bool>()
            {
                Error       = error,
                ReturnValue = new List <bool>()
                {
                    error == null
                }
            };

            return(ret);
        }
        /// <summary>
        /// Commits a Submission in HWDC
        /// </summary>
        /// <param name="productId">Specifiy the Product ID for the Submission to commit</param>
        /// <param name="submissionId">Specifiy the Submission ID for the Submission to commit</param>
        /// <returns>Dev Center response with either an error or a true if comitted successfully</returns>
        public async Task <DevCenterResponse <bool> > CommitSubmission(string productId, string submissionId)
        {
            string commitProductSubmissionUrl = GetDevCenterBaseUrl() +
                                                string.Format(DevCenterProductSubmissionCommitUrl, Uri.EscapeDataString(productId), Uri.EscapeDataString(submissionId));
            DevCenterErrorDetails error = await InvokeHdcService(HttpMethod.Post, commitProductSubmissionUrl, null, null);

            DevCenterResponse <bool> ret = new DevCenterResponse <bool>()
            {
                Error       = error,
                ReturnValue = new List <bool>()
                {
                    error == null
                }
            };

            if (error != null)
            {
                if ((error.HttpErrorCode.HasValue) &&
                    (error.HttpErrorCode.Value == (int)System.Net.HttpStatusCode.BadGateway) &&
                    (string.Compare(error.Code, "requestInvalidForCurrentState", true) == 0)
                    )
                {
                    //  Communication issue likely caused the submission to already be done.  Check.
                    DevCenterResponse <Submission> SubmissionStatus = await GetSubmission(productId, submissionId);

                    if (SubmissionStatus.Error == null)
                    {
                        Submission s = SubmissionStatus.ReturnValue[0];
                        if (string.Compare(s.CommitStatus, "commitComplete", true) == 0)
                        {
                            //Actually did commit
                            ret.Error       = null;
                            ret.ReturnValue = new List <bool>()
                            {
                                true
                            };
                        }
                    }
                }
            }

            return(ret);
        }