public IHttpActionResult GetByName(string name) { try { var grades = _gradeService.FindByName(name); return(Ok(grades .Select(g => { return GetGradeDto(g); }))); } catch (ArgumentNullException ane) { ModelState.AddModelError("", ane.Message); } return(BadRequest(ModelState)); }