class BudgetReAppropriationController {

    @PostMapping("/_create")
    @ResponseStatus(HttpStatus.CREATED)
    public BudgetReAppropriationResponse create(@RequestBody final BudgetReAppropriationRequest budgetReAppropriationRequest,
            final BindingResult errors) {

        final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper();
        final BudgetReAppropriationResponse budgetReAppropriationResponse = new BudgetReAppropriationResponse();
        budgetReAppropriationResponse.setResponseInfo(getResponseInfo(budgetReAppropriationRequest.getRequestInfo()));
        List<BudgetReAppropriation> budgetreappropriations = new ArrayList<>();
        BudgetReAppropriation budgetReAppropriation = null;
        final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>();
        BudgetReAppropriationContract contract = null;

        budgetReAppropriationRequest.getRequestInfo().setAction(ACTION_CREATE);

        for (final BudgetReAppropriationContract budgetReAppropriationContract : budgetReAppropriationRequest
                .getBudgetReAppropriations()) {
            budgetReAppropriation = mapper.toDomain(budgetReAppropriationContract);
            budgetReAppropriation.setCreatedBy(budgetReAppropriationRequest.getRequestInfo().getUserInfo());
            budgetReAppropriation.setLastModifiedBy(budgetReAppropriationRequest.getRequestInfo().getUserInfo());
            budgetreappropriations.add(budgetReAppropriation);
        }

        budgetreappropriations = budgetReAppropriationService.create(budgetreappropriations, errors,
                budgetReAppropriationRequest.getRequestInfo());

        for (final BudgetReAppropriation bra : budgetreappropriations) {
            contract = mapper.toContract(bra);
            budgetReAppropriationContracts.add(contract);
        }

        budgetReAppropriationResponse.setBudgetReAppropriations(budgetReAppropriationContracts);

        return budgetReAppropriationResponse;
    }

}