class SurrenderReasonController {

    @PostMapping("/_create")
    @ResponseStatus(HttpStatus.CREATED)
    public SurrenderReasonResponse create(@RequestBody SurrenderReasonRequest surrenderReasonRequest,
            BindingResult errors) {

        SurrenderReasonMapper mapper = new SurrenderReasonMapper();
        SurrenderReasonResponse surrenderReasonResponse = new SurrenderReasonResponse();
        surrenderReasonResponse.setResponseInfo(getResponseInfo(surrenderReasonRequest.getRequestInfo()));
        List<SurrenderReason> surrenderreasons = new ArrayList<>();
        SurrenderReason surrenderReason;
        List<SurrenderReasonContract> surrenderReasonContracts = new ArrayList<>();
        SurrenderReasonContract contract;

        surrenderReasonRequest.getRequestInfo().setAction(ACTION_CREATE);

        for (SurrenderReasonContract surrenderReasonContract : surrenderReasonRequest.getSurrenderReasons()) {
            surrenderReason = mapper.toDomain(surrenderReasonContract);
            surrenderReason.setCreatedDate(new Date());
            surrenderReason.setCreatedBy(surrenderReasonRequest.getRequestInfo().getUserInfo());
            surrenderReason.setLastModifiedBy(surrenderReasonRequest.getRequestInfo().getUserInfo());
            surrenderreasons.add(surrenderReason);
        }

        surrenderreasons = surrenderReasonService.create(surrenderreasons, errors,
                surrenderReasonRequest.getRequestInfo());

        for (SurrenderReason sr : surrenderreasons) {
            contract = mapper.toContract(sr);
            surrenderReasonContracts.add(contract);
        }

        surrenderReasonResponse.setSurrenderReasons(surrenderReasonContracts);

        return surrenderReasonResponse;
    }

}