public IHttpActionResult Get(int countryId) { HttpResponseMessage response = null; try { var countries = _stateHandler.GetByCountry(countryId); return(Ok(new ReturnData(DataList.CodeStatus.Ok, "States extracted", countries))); } catch (CException e) { response = Request.CreateResponse((HttpStatusCode)510, new ReturnData(e.Status, e.Message)); } return(new ResponseMessageResult(response)); }