public async Task <OneOf <Success, NotFound> > SendNotificationAsync(NotificationRequest request) { Email email; try { email = await _emailFactory.BuildAsync(request); } catch (ArgumentException ex) { _logger.LogError(ex, ex.Message); return(new NotFound()); } try { await email.SendAsync(); _unitOfWork.EmailRepository.Add(email); _unitOfWork.Save(); return(new Success()); } catch (NotificationFailedException ex) { _logger.LogError(ex, $"{nameof(SendNotificationAsync)} failed to send notification."); throw; } }