public ActionResult SaveUserSettings([FromBody] SaveUserSettingsModel model) { if (Context == null || string.IsNullOrWhiteSpace(Context.UserId)) { return(CreateResponse("Unable to get token")); } if (model == null) { return(CreateResponse("None of the parameters can be null")); } Validator validator = new Validator(); bool passedEmailValidation = model.NotificationRecipients.All(x => validator.IsValidEmail(x)); if (!passedEmailValidation) { return(CreateResponse("Invalid email address in recipients list")); } bool saved = userCore.SaveSettings(new Settings { EnabledNotifications = model.EnabledNotifications, NotificationRecipients = model.NotificationRecipients, UserId = ObjectId.Parse(Context.UserId) }); return(CreateResponse(success: saved)); }