public async Task <IActionResult> SendNotification([FromBody] Notification notification) { try { await _dao.AddNotificationLocations(notification); List <UserSmsLocation> smsLocations = await _dao.GetUserSMSLocationsForNotification(notification); int smsSent = await _sms.SendSmsForNotification(notification, smsLocations); List <UserEmailLocation> emailLocations = await _dao.GetUserEmailLocationsForNotification(notification); int emailSent = await _email.SendEmailForNotification(notification, emailLocations); return(new OkObjectResult($"Notified {smsSent}/{smsLocations.Count} users via SMS. Notified {emailSent}/{emailLocations.Count} users via email.")); } catch (Exception e) { _logger.LogInformation($"Error sending notification. The error was: {e.Message}, stack trace was: {e.StackTrace}"); return(BadRequest($"Error sending notification. The error was: {e.Message}")); } }