public async Task <IHttpActionResult> SaveProfile(UserProfileModel model) { var person = SecurityPrincipal.Current; var role = person.Role; // TODO: If this application grows into something bigger it is important to // refactor this into a more extensible pattern like a chain of responsibility. if (role.Equals("Parent", System.StringComparison.InvariantCultureIgnoreCase)) { return(Ok(await _parentsService.SaveParentProfileAsync(person.PersonUSI, model))); } return(Ok(await _teachersService.SaveStaffProfileAsync(person.PersonUSI, model))); }