class VoucherSubTypeController {

    @PostMapping("/_update")
    @ResponseStatus(HttpStatus.CREATED)
    public VoucherSubTypeResponse update(@RequestBody VoucherSubTypeRequest voucherSubTypeRequest, BindingResult errors) {

        voucherSubTypeRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE);
        ModelMapper model = new ModelMapper();
        VoucherSubTypeResponse voucherSubTypeResponse = new VoucherSubTypeResponse();
        List<VoucherSubType> voucherSubTypes = new ArrayList<>();
        voucherSubTypeResponse.setResponseInfo(getResponseInfo(voucherSubTypeRequest.getRequestInfo()));
        VoucherSubType voucherSubType;
        VoucherSubTypeContract contract;
        List<VoucherSubTypeContract> voucherSubTypeContracts = new ArrayList<>();

        for (VoucherSubTypeContract voucherSubTypeContract : voucherSubTypeRequest.getVoucherSubTypes()) {
            voucherSubType = new VoucherSubType();
            model.map(voucherSubTypeContract, voucherSubType);
            voucherSubType.setLastModifiedBy(voucherSubTypeRequest.getRequestInfo().getUserInfo());
            voucherSubType.setLastModifiedDate(new Date());
            voucherSubTypes.add(voucherSubType);
        }

        voucherSubTypes = voucherSubTypeService.update(voucherSubTypes, errors, voucherSubTypeRequest.getRequestInfo());

        for (VoucherSubType voucherSubTypeObj : voucherSubTypes) {
            contract = new VoucherSubTypeContract();
            model.map(voucherSubTypeObj, contract);
            voucherSubTypeContracts.add(contract);
        }

        voucherSubTypeResponse.setVoucherSubTypes(voucherSubTypeContracts);

        return voucherSubTypeResponse;
    }

}