public async Task <Transaction> Handle(WithdrawCommand command)
        {
            Account account = await accountReadOnlyRepository.GetAccount(command.AccountId);

            if (account == null)
            {
                throw new AccountNotFoundException($"The account {command.AccountId} does not exists or is already closed.");
            }

            Transaction transaction = Debit.Create(command.CustomerId, Amount.Create(command.Amount));

            account.Withdraw(transaction);

            var domainEvents = account.GetEvents();
            await bus.Publish(domainEvents, command.Header);

            bool received = false;

            for (int i = 0; i < 5; i++)
            {
                received = await accountReadOnlyRepository.CheckTransactionReceived(account.Id, transaction.Id);

                if (received)
                {
                    break;
                }
            }

            //if (!received)
            //{
            //}

            return(transaction);
        }