class BudgetController {

    @PostMapping("/_update")
    @ResponseStatus(HttpStatus.CREATED)
    public BudgetResponse update(@RequestBody @Valid final BudgetRequest budgetRequest, final BindingResult errors) {

        final BudgetMapper mapper = new BudgetMapper();
        final BudgetResponse budgetResponse = new BudgetResponse();
        budgetResponse.setResponseInfo(getResponseInfo(budgetRequest.getRequestInfo()));
        List<Budget> budgets = new ArrayList<>();
        Budget budget = null;
        BudgetContract contract = null;
        final List<BudgetContract> budgetContracts = new ArrayList<BudgetContract>();

        budgetRequest.getRequestInfo().setAction(ACTION_UPDATE);

        for (final BudgetContract budgetContract : budgetRequest.getBudgets()) {
            budget = mapper.toDomain(budgetContract);
            budget.setLastModifiedBy(budgetRequest.getRequestInfo().getUserInfo());
            budgets.add(budget);
        }

        budgets = budgetService.update(budgets, errors, budgetRequest.getRequestInfo());

        for (final Budget b : budgets) {
            contract = mapper.toContract(b);
            budgetContracts.add(contract);
        }

        budgetResponse.setBudgets(budgetContracts);

        return budgetResponse;
    }

}