public HttpResponseMessage SaveEducationDetails(HttpRequestMessage request, Education education) { Institution institution = null; var student = _studentApi.GetStudent(education.StudentId); var schoolExists = _studentApi.InstitutionExists(education.InstitutionName); if (schoolExists) { institution = _studentApi.GetInstitution(education.InstitutionName); } else { institution = new Institution() { Name = education.InstitutionName, Type = education.CurrentOccupation }; _studentApi.SaveInstitution(institution); } student.InstitutionID = institution.ID; student.StudyField = education.StudyField; student.CurrentOccupation = education.CurrentOccupation; _studentApi.SaveStudent(student); var response = request.CreateResponse(HttpStatusCode.OK); return(response); }