/// <summary>
        /// Updates the balance for the given currency and Account ID
        /// </summary>
        /// <param name="currency"></param>
        /// <param name="accountId"></param>
        /// <param name="volume"></param>
        /// <param name="orderId"> </param>
        /// <param name="fee"> </param>
        /// <param name="isPending"> </param>
        /// <returns></returns>
        private decimal UpdateBalanceAfterTrade(Currency currency, AccountId accountId, decimal volume, string orderId,
                                                decimal fee, bool isPending)
        {
            Balance balance = _balanceRepository.GetBalanceByCurrencyAndAccountId(currency, accountId);

            if (balance != null)
            {
                if (!isPending)
                {
                    balance.AddAvailableBalance(volume);
                    balance.AddCurrentBalance(volume);
                }
                else
                {
                    balance.ConfirmPendingTransaction(orderId, PendingTransactionType.Order, volume);
                }
                if (fee != 0.0M)
                {
                    balance.AddAvailableBalance(-fee);
                    balance.AddCurrentBalance(-fee);
                }
                _fundsPersistenceRepository.SaveOrUpdate(balance);
                return(balance.CurrentBalance);
            }
            return(0);
        }