class InstrumentAccountCodeController {

    @PostMapping("/_update")
    @ResponseStatus(HttpStatus.CREATED)
    public InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors) {

        InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper();
        instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_UPDATE);
        InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse();
        List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>();
        instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo()));
        InstrumentAccountCode instrumentAccountCode;
        InstrumentAccountCodeContract contract;
        List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>();

        for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest
                .getInstrumentAccountCodes()) {
            instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract);
            instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo());
            instrumentAccountCode.setLastModifiedDate(new Date());
            instrumentaccountcodes.add(instrumentAccountCode);
        }

        instrumentaccountcodes = instrumentAccountCodeService.update(instrumentaccountcodes, errors,
                instrumentAccountCodeRequest.getRequestInfo());

        for (InstrumentAccountCode iac : instrumentaccountcodes) {
            contract = mapper.toContract(iac);
            instrumentAccountCodeContracts.add(contract);
        }

        instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts);

        return instrumentAccountCodeResponse;
    }

}