public async Task LogAsync(string emailServiceId, string[] receivers, string template, JObject personalContent, JObject content) { Guid id = Guid.NewGuid(); DateTime timestamp = DateTime.Now; JObject obfuscatedPersonalContent = GetObfuscatedPersonalContent(personalContent); string[] hashedEmailReceivers = GetHashedEmailReceivers(receivers); string singleStringEmailReceivers = ArrayUtility.GetCommaSeparatedArray(hashedEmailReceivers); string nonFormattedObfuscatedPersonalContent = obfuscatedPersonalContent.ToString(Formatting.None); string nonFormattedContent = content.ToString(Formatting.None); LogEntry logEntry = new LogEntry() { Id = id, EmailServiceId = emailServiceId, Timestamp = timestamp, To = singleStringEmailReceivers, Template = template, PersonalContent = nonFormattedObfuscatedPersonalContent, Content = nonFormattedContent }; bool isApiLogging = _serviceConfiguration.SelectedLoggingType.Equals(ServiceConfiguration.LoggingType.API); bool isDatabaseLogging = _serviceConfiguration.SelectedLoggingType.Equals(ServiceConfiguration.LoggingType.DATABASE); if (isApiLogging) { await LogToApiAsync(logEntry); } else if (isDatabaseLogging) { await LogToDatabaseAsync(logEntry); } }