public IHttpActionResult GetByName(string name) { try { var majors = _majorService.FindByName(name); return(Ok(majors .Select(m => { return GetMajorDto(m); }))); } catch (ArgumentNullException ane) { ModelState.AddModelError("", ane.Message); } return(BadRequest(ModelState)); }