public async Task <IHttpActionResult> EditHobby([FromUri] int id, [FromBody] EditHobbyViewModel model) { //Check null for model if (model == null) { model = new EditHobbyViewModel(); Validate(model); } //Validate model if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var hobby = await _hobbyService.EditHobbyAsync(id, model, CancellationToken.None); return(Ok(hobby)); }