public async Task UpdateAsync(string assetId, decimal amount, string comment, string userId) { Credit credit = await GetByAssetIdAsync(assetId); credit.Add(amount); string walletId = await _settingsService.GetWalletIdAsync(); if (amount > 0) { await _lykkeExchangeService.CashInAsync(walletId, assetId, Math.Abs(amount), userId, comment); } else { await _lykkeExchangeService.CashOutAsync(walletId, assetId, Math.Abs(amount), userId, comment); } await _creditRepository.InsertOrReplaceAsync(credit); _cache.Set(credit); var balanceOperation = new BalanceOperation { Time = DateTime.UtcNow, AssetId = assetId, Type = "Credit", Amount = amount, Comment = comment, UserId = userId }; await _balanceOperationService.AddAsync(balanceOperation); _log.InfoWithDetails("Credit was updated", balanceOperation); }