private static void DebitApplied(MemoryCache cache, DebitApplied message)
        {
            var account = Account.Parse(message.Account);

            if (!account.ContainsComponent <WarehouseLocationComponent>())
            {
                return;
            }

            var accountId   = account.GetId();
            var location    = account.GetComponent <WarehouseLocationComponent>();
            var reservation = account.TryGetComponent <ReservationComponent>();

            var id = StockLinePartId.NewId(message.SkuId, accountId, message.SkuMetadata);

            message.SkuMetadata.TryGetValue("Batch", out var batchValue);

            if (cache.TryGetValue(id, out StockLine stockLine))
            {
                stockLine.Amount += message.Amount;
            }
            else
            {
                cache.Set(id,
                          new StockLine
                {
                    SkuId          = message.SkuId,
                    Amount         = message.Amount,
                    LocationId     = location.LocationId,
                    ReservationId  = reservation?.ReservationId,
                    Batch          = Convert.ToString(batchValue),
                    AccountId      = accountId.ToString(),
                    NetWeight      = cache.Get <Sku>(message.SkuId).GetNetWeight() * message.Amount,
                    Account        = account.ToString(),
                    SkuDescription = cache.Get <Sku>(message.SkuId).Description
                });
            }
        }
        private static void CreditApplied(MemoryCache cache, CreditApplied message)
        {
            var account = Account.Parse(message.Account);

            if (!account.ContainsComponent <WarehouseLocationComponent>())
            {
                return;
            }

            var accountId = account.GetId();

            var id = StockLinePartId.NewId(message.SkuId, accountId, message.SkuMetadata);

            if (cache.TryGetValue(id, out StockLine stockLine))
            {
                stockLine.Amount   -= message.Amount;
                stockLine.NetWeight = cache.Get <Sku>(message.SkuId).GetNetWeight() * stockLine.Amount;

                if (stockLine.Amount == 0)
                {
                    cache.Remove(id);
                }
            }
        }