class BudgetDetailController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract,
            @RequestBody final RequestInfo requestInfo, final BindingResult errors) {

        final BudgetDetailMapper mapper = new BudgetDetailMapper();
        final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract);
        BudgetDetailContract contract = null;
        final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>();

        final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain);

        for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) {
            contract = mapper.toContract(budgetDetail);
            budgetDetailContracts.add(contract);
        }

        final BudgetDetailResponse response = new BudgetDetailResponse();
        response.setBudgetDetails(budgetDetailContracts);
        response.setPage(new PaginationContract(budgetdetails));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}