public IActionResult GetByName(string name) { if (!ModelState.IsValid) { return(BadRequest(new ApiBadRequestResponse(ModelState))); } var model = _carModelService.GetCarModelByName(name); if (model == null) { return(NotFound(new ApiResponse(400, "Car model invalid."))); } return(Ok(new ApiOkResponse(model))); }