public async Task <Wallet> Create(Wallet wallet) { wallet.Id = Guid.NewGuid(); if (wallet == null) { return(null); } if (!await WalletValidator.Create(wallet)) { return(wallet); } using (UnitOfWork.Begin()) { try { await UnitOfWork.WalletRepository.Create(wallet); await UnitOfWork.Commit(); } catch (Exception ex) { await UnitOfWork.Rollback(); wallet.AddError(nameof(WalletService), nameof(wallet.Id), CommonEnum.ErrorCode.SystemError); } } return(wallet); }