public ActionResult <ItemResponse <Paged <Provider> > > Search(string q, int pageIndex, int pageSize) { int code = 200; BaseResponse response = null; try { Paged <Provider> providerSearch = _service.Search(q, pageIndex, pageSize); if (providerSearch == null) { code = 404; response = new ErrorResponse("App resource not found."); } else { response = new ItemResponse <Paged <Provider> > { Item = providerSearch }; } } catch (Exception ex) { code = 500; response = new ErrorResponse(ex.Message); base.Logger.LogError(ex.ToString()); } return(StatusCode(code, response)); }