class InstrumentAccountCodeController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public InstrumentAccountCodeResponse search(
            @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract,
            RequestInfo requestInfo, BindingResult errors) {

        InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper();
        InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract);
        InstrumentAccountCodeContract contract;
        List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>();
        Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain);

        if (instrumentaccountcodes.getPagedData() != null)
            for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) {
                contract = mapper.toContract(instrumentAccountCode);
                instrumentAccountCodeContracts.add(contract);
            }

        InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse();
        response.setInstrumentAccountCodes(instrumentAccountCodeContracts);
        response.setPage(new PaginationContract(instrumentaccountcodes));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}