public async Task <Result <CurrenciesErrorCodes> > UpdateAsync(Currency currency, string username, string correlationId) { var existing = await _currenciesRepository.GetByIdAsync(currency.Id); if (existing.IsSuccess) { currency.Timestamp = existing.Value.Timestamp; var result = await _currenciesRepository.UpdateAsync(currency); if (result.IsSuccess) { await _auditService.TryAudit(correlationId, username, currency.Id, AuditDataType.Currency, currency.ToJson(), existing.Value.ToJson()); await PublishCurrencyChangedEvent(existing.Value, currency, username, correlationId, ChangeType.Edition); } return(result); } return(existing.ToResultWithoutValue()); }