public HttpResponseMessage Post(StaffToAdd staffToAdd) { Notification notificationService = null; // for each staff id in the staffid array, add to the db. foreach (var staffId in staffToAdd.StaffId) { // add staff _db.StaffOnTask.Add(new StaffOnTask() { StaffId = staffId, AnthRTaskId = staffToAdd.AnthRTaskId }); // send off email to the staff member informing them of the new task notificationService = new Notification(); notificationService.SendTaskEmail(staffToAdd.AnthRTaskId, staffId); } _db.SaveChanges(); return new HttpResponseMessage(HttpStatusCode.OK); }