public IHttpActionResult AssignStudentToClass(string studentId, int classId) { try { var retVal = service.AddStudentToClass(studentId, classId); logger.Info("Added student {0} to class {1}", studentId, classId); return(Ok(retVal)); } catch (Exception e) { logger.Warn("Exception caught with message {0}. Returning bad request.", e.Message); return(BadRequest(e.Message)); } }