/// <summary>
        ///	Creates a new listing
        /// </summary>
        /// <param name="request"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public async Task CreateListing(PostListingRequest request, CancellationToken token)
        {
            var mark = Mark.CreateNew();
            var url  = String.Format(EtsyEndPoint.CreateListingUrl, Config.ShopName);

            try
            {
                EtsyLogger.LogStarted(this.CreateMethodCallInfo(url, mark, additionalInfo: this.AdditionalLogInfo()));

                var payload = new Dictionary <string, string>
                {
                    { "quantity", request.Quantity.ToString() },
                    { "title", request.Title },
                    { "description", request.Description },
                    { "price", request.Price.ToString() },
                    { "who_made", request.WhoMade.ToString() },
                    { "is_supply", request.IsSupply.ToString() },
                    { "when_made", request.WhenMade },
                    { "state", request.State.ToString() },
                    { "shipping_template_id", request.ShippingTemplateId.ToString() }
                };

                await base.PostAsync(url, payload, token, mark).ConfigureAwait(false);

                EtsyLogger.LogEnd(this.CreateMethodCallInfo(url, mark, methodResult: request.ToJson(), additionalInfo: this.AdditionalLogInfo()));
            }
            catch (Exception exception)
            {
                var etsyException = new EtsyException(this.CreateMethodCallInfo(url, mark, additionalInfo: this.AdditionalLogInfo()), exception);
                EtsyLogger.LogTraceException(etsyException);
                throw etsyException;
            }
        }
        public async Task <string> PostListingAsync([FromBody] PostListingRequest request)
        {
            try
            {
                var myitem = new EbayInventoryItem
                {
                    condition    = request.inventoryItem.condition,
                    product      = request.inventoryItem.product,
                    availability = request.inventoryItem.availability
                };
                var createInventoryItemResponse = CreateEbayInventoryItem(myitem).Result;
                if ((bool)createInventoryItemResponse.IsSuccess)
                {
                    var sku   = createInventoryItemResponse.Sku;
                    var offer = new Offer(request.paymentPolicyId, request.fulfillmentPolicyId, request.returnPolicyId, request.merchantLocationKey, request.price, sku);
                    offer.categoryId = request.categoryId;
                    var offerId = CreateOffer(offer).Result.offerId;
                    var publishOfferResponse = await PublishOffer(offerId);

                    return(publishOfferResponse.ListingId);
                }
                throw new Exception("Problem generating inventory item: " + createInventoryItemResponse.ErrorMessage);
            }
            catch (Exception ex)
            {
                Response.StatusCode = 400;
                telemetryClient.TrackException(ex);
                //return new PostListingResponse
                //{
                //    IsSuccess = false,
                //    ErrorMessage = ex.Message
                //};
                return(ex.Message);
            }
        }