class InstrumentTypeController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public InstrumentTypeResponse search(@ModelAttribute InstrumentTypeSearchContract instrumentTypeSearchContract,
            RequestInfo requestInfo, BindingResult errors) {

        InstrumentTypeMapper mapper = new InstrumentTypeMapper();
        InstrumentTypeSearch domain = mapper.toSearchDomain(instrumentTypeSearchContract);
        InstrumentTypeContract contract;
        List<InstrumentTypeContract> instrumentTypeContracts = new ArrayList<>();
        Pagination<InstrumentType> instrumenttypes = instrumentTypeService.search(domain);

        if (instrumenttypes.getPagedData() != null)
            for (InstrumentType instrumentType : instrumenttypes.getPagedData()) {
                contract = mapper.toContract(instrumentType);
                instrumentTypeContracts.add(contract);
            }

        InstrumentTypeResponse response = new InstrumentTypeResponse();
        response.setInstrumentTypes(instrumentTypeContracts);
        response.setPage(new PaginationContract(instrumenttypes));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}