public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeletePhysicalInventoryDto value)
        {
            var idObj = id;

            if (value.DocumentNumber == null)
            {
                value.DocumentNumber = idObj;
            }
            else if (!((ICreateOrMergePatchOrDeletePhysicalInventory)value).DocumentNumber.Equals(idObj))
            {
                throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.DocumentNumber);
            }
        }
        public void Put(string id, [FromBody] CreateOrMergePatchOrDeletePhysicalInventoryDto value)
        {
            try {
                // ///////////////////////////////
                if (value.Version != default(long))
                {
                    value.CommandType = CommandType.MergePatch;
                    PhysicalInventoriesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                    _physicalInventoryApplicationService.When(value as IMergePatchPhysicalInventory);
                    return;
                }
                // ///////////////////////////////

                PhysicalInventoriesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _physicalInventoryApplicationService.When(value as ICreatePhysicalInventory);
            } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }