private async Task <IWalletBalance> UpdateBitcoinBalance(IObservableWallet wallet, int height,
                                                                 int minConfirmations)
        {
            var unspentOutputs = await _blockChainProvider.GetUnspentOutputsAsync(wallet.Address, minConfirmations);

            var coins = await _unspentCoinsProvider.FilterAsync(unspentOutputs);

            var balance = coins.Select(o => o.Amount).DefaultIfEmpty().Sum(p => p?.Satoshi ?? 0);

            _log.Info("Bitcoin balance retrieved from provider and filtered", context: new { Address = wallet.Address, Height = height, MinConfirmation = minConfirmations, Balance = balance });

            if (balance != 0)
            {
                var walletBalanceEntity =
                    WalletBalance.Create(wallet.Address, balance, height, Constants.Assets.Bitcoin.AssetId);
                await _balanceRepository.InsertOrReplaceAsync(walletBalanceEntity);

                return(walletBalanceEntity);
            }

            await _balanceRepository.DeleteIfExistAsync(wallet.Address, Constants.Assets.Bitcoin.AssetId);

            return(null);
        }
        public async Task <IEnumerable <Coin> > GetUnspentOutputsAsync(string address, int confirmationsCount)
        {
            var blockchainOutputs = await _blockChainProvider.GetUnspentOutputsAsync(address, confirmationsCount);

            return(await _unspentCoinsProvider.FilterAsync(await AddInternalOutputsAsync(blockchainOutputs, address, confirmationsCount)));
        }