public Task InsertOrReplaceAsync(IWalletBalance balance) { return(_storage.InsertOrReplaceAsync(WalletBalanceEntity.Create(balance), existed => { var needToUpdate = existed.UpdatedAtBlockHeight < balance.UpdatedAtBlockHeight; if (needToUpdate) { _log.Info("Updating wallet balance in db", context: balance); } return existed.UpdatedAtBlockHeight < balance.UpdatedAtBlockHeight; })); }