public async Task <UserBalanceQueryResult> Ask(UserBalanceCriterion criterion)
        {
            var balance = await _queryBuilder
                          .ForGeneric <UserBalance>()
                          .Where(UserBalanceSpecifications.WithNonZeroId())
                          .FirstOrDefaultAsync();

            return(new UserBalanceQueryResult(balance?.Balance ?? 0));
        }
        public async Task <Result> Handle(ChangeBalanceCmd message)
        {
            var aggregate = await _repository
                            .FindOne(UserBalanceSpecifications.WithNonZeroId());

            aggregate ??= _repository.Create();

            return(await aggregate.ChangeBalance(message.Amount)
                   .Tap(async aggr =>
            {
                if (!aggregate.IsNew)
                {
                    _repository.Update(aggr);
                }

                await _domainUow.Commit();
            }));
        }