public async Task WhenAsync(MergePatchSellableInventoryItemDto c)
        {
            var idObj         = SellableInventoryItemProxyUtils.ToIdString((c as IMergePatchSellableInventoryItem).SellableInventoryItemId);
            var uriParameters = new SellableInventoryItemUriParameters();

            uriParameters.Id = idObj;

            var req  = new SellableInventoryItemPatchRequest(uriParameters, (MergePatchSellableInventoryItemDto)c);
            var resp = await _ramlClient.SellableInventoryItem.Patch(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <ISellableInventoryItemEvent> GetStateEventAsync(InventoryItemId sellableInventoryItemId, long version)
        {
            var idObj         = SellableInventoryItemProxyUtils.ToIdString(sellableInventoryItemId);
            var uriParameters = new SellableInventoryItemStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new SellableInventoryItemStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.SellableInventoryItemStateEvent.Get(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <ISellableInventoryItemState> GetHistoryStateAsync(InventoryItemId sellableInventoryItemId, long version)
        {
            var idObj         = SellableInventoryItemProxyUtils.ToIdString(sellableInventoryItemId);
            var uriParameters = new SellableInventoryItemHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new SellableInventoryItemHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.SellableInventoryItemHistoryState.Get(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToSellableInventoryItemState());
        }
        public async Task <ISellableInventoryItemState> GetAsync(InventoryItemId sellableInventoryItemId)
        {
            ISellableInventoryItemState state = null;
            var idObj         = SellableInventoryItemProxyUtils.ToIdString(sellableInventoryItemId);
            var uriParameters = new SellableInventoryItemUriParameters();

            uriParameters.Id = idObj;

            var req = new SellableInventoryItemGetRequest(uriParameters);

            var resp = await _ramlClient.SellableInventoryItem.Get(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToSellableInventoryItemState();
            return(state);
        }
        public async Task WhenAsync(DeleteSellableInventoryItemDto c)
        {
            var idObj         = SellableInventoryItemProxyUtils.ToIdString((c as IDeleteSellableInventoryItem).SellableInventoryItemId);
            var uriParameters = new SellableInventoryItemUriParameters();

            uriParameters.Id = idObj;

            var q = new SellableInventoryItemDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new SellableInventoryItemDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.SellableInventoryItem.Delete(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
        }