public ActionResult Post([FromBody] Student student) { String error; if (StudentUtility.checkForValidStudent(out error, student)) { Object result = StudentTable.insertStudent(student); Student student1 = result as Student; if (null != student1) { return(Ok(result)); } else { return(NotFound(result)); } } else { return(NotFound(new ErrorText(error))); } }