public void AfterChange(ShippingWarehouse entity, string oldValue, string newValue)
        {
            var cleanAddress = string.IsNullOrEmpty(newValue) ? null : _cleanAddressService.CleanAddress(newValue);

            entity.Address       = cleanAddress?.ResultAddress ?? entity.Address;
            entity.PostalCode    = cleanAddress?.PostalCode;
            entity.Region        = cleanAddress?.Region;
            entity.Area          = cleanAddress?.Area;
            entity.City          = cleanAddress?.City;
            entity.Settlement    = cleanAddress?.Settlement;
            entity.Street        = cleanAddress?.Street;
            entity.House         = cleanAddress?.House;
            entity.Block         = cleanAddress?.Block;
            entity.UnparsedParts = cleanAddress?.UnparsedAddressParts;

            var validStatuses = new[] { OrderState.Created, OrderState.InShipping };
            var orders        = _dataService.GetDbSet <Order>()
                                .Where(x => x.ShippingWarehouseId == entity.Id &&
                                       x.ShippingAddress != entity.Address &&
                                       validStatuses.Contains(x.Status) &&
                                       (x.ShippingId == null || x.OrderShippingStatus == ShippingState.ShippingCreated))
                                .ToList();

            foreach (var order in orders)
            {
                _historyService.SaveImpersonated(null, order.Id, "fieldChanged",
                                                 nameof(order.ShippingAddress).ToLowerFirstLetter(),
                                                 order.ShippingAddress, entity.Address);
                order.ShippingAddress = entity.Address;
            }
        }
        public void Execute(Warehouse shipping)
        {
            string rawAddress   = $"{shipping.City} {shipping.Address}";
            var    cleanAddress = string.IsNullOrEmpty(rawAddress) ? null : _cleanAddressService.CleanAddress(rawAddress);

            shipping.ValidAddress         = cleanAddress?.ResultAddress;
            shipping.PostalCode           = cleanAddress?.PostalCode;
            shipping.Region               = cleanAddress?.Region;
            shipping.City                 = cleanAddress?.City;
            shipping.Area                 = cleanAddress?.Area;
            shipping.Street               = cleanAddress?.Street;
            shipping.House                = cleanAddress?.House;
            shipping.UnparsedAddressParts = cleanAddress?.UnparsedAddressParts;

            var validStatuses = new[] { OrderState.Created, OrderState.InShipping };
            var orders        = _dataService.GetDbSet <Order>()
                                .Where(x => x.DeliveryWarehouseId == shipping.Id &&
                                       validStatuses.Contains(x.Status) &&
                                       (x.ShippingId == null || x.OrderShippingStatus == ShippingState.ShippingCreated))
                                .ToList();

            foreach (var order in orders)
            {
                if (order.DeliveryAddress != shipping.Address)
                {
                    _historyService.SaveImpersonated(null, order.Id, "fieldChanged",
                                                     nameof(order.DeliveryAddress).ToLowerFirstLetter(),
                                                     order.DeliveryAddress, shipping.Address);
                    order.DeliveryAddress = shipping.Address;
                }

                if (order.DeliveryRegion != shipping.Region)
                {
                    _historyService.SaveImpersonated(null, order.Id, "fieldChanged",
                                                     nameof(order.DeliveryRegion).ToLowerFirstLetter(),
                                                     order.DeliveryRegion, shipping.Region);
                    order.DeliveryRegion = shipping.Region;
                }

                if (order.DeliveryCity != shipping.City)
                {
                    _historyService.SaveImpersonated(null, order.Id, "fieldChanged",
                                                     nameof(order.DeliveryCity).ToLowerFirstLetter(),
                                                     order.DeliveryCity, shipping.City);
                    order.DeliveryCity = shipping.City;
                }
            }
        }