public override Task <OrderNumberEntity> RunAsync(GenerateOrderNumberArgument arg, CommercePipelineExecutionContext context)
        {
            var orderNumberPolicy = context.GetPolicy <OrderNumberPolicy>();

            var shopName = context.CommerceContext.CurrentShopName();

            if (string.IsNullOrEmpty(shopName))
            {
                shopName = DefaultOrderNumberLockKey;
            }

            var lockObject = LockTable.GetOrAdd(shopName, x => new object());

            lock (lockObject)
            {
                Condition.Requires(_findEntityPipeline, "findEntitiesPipeline");

                var findEntityArgument = new FindEntityArgument(typeof(OrderNumberEntity), OrderNumberEntity.OrderNumberEntityId);

                var foundEntity = _findEntityPipeline.RunAsync(findEntityArgument, context).Result;

                var result = foundEntity as OrderNumberEntity;

                if (result == null)
                {
                    result = new OrderNumberEntity()
                    {
                        UniqueId        = Guid.NewGuid(),
                        Id              = OrderNumberEntity.OrderNumberEntityId,
                        Version         = 1,
                        LastOrderNumber = orderNumberPolicy?.StartNumber ?? 1,
                        DateCreated     = DateTimeOffset.Now
                    };
                }
                else
                {
                    result.LastOrderNumber += 1;
                    result.DateUpdated      = DateTimeOffset.Now;
                }

                var persistEntity = _persistEntityPipeline.RunAsync(new PersistEntityArgument(result), context).Result;

                return(Task.FromResult(result));
            }
        }