public async Task <IHttpActionResult> EditGroupName(int groupID, string newName) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (string.IsNullOrWhiteSpace(newName)) { return(BadRequest()); } Group group = await Task.Run(() => { return(db.Groups.Where((g) => g.GroupID == groupID).FirstOrDefault()); }); if (group == null) { return(NotFound()); } await db.EditGroupName(groupID, newName); return(Ok()); }