class BudgetRepository {

    @Transactional
    public List<Budget> update(final List<Budget> budgets, final RequestInfo requestInfo) {

        final BudgetMapper mapper = new BudgetMapper();

        if (persistThroughKafka != null && !persistThroughKafka.isEmpty()
                && persistThroughKafka.equalsIgnoreCase("yes")) {

            final BudgetRequest request = new BudgetRequest();
            request.setRequestInfo(requestInfo);
            request.setBudgets(new ArrayList<>());

            for (final Budget iac : budgets)
                request.getBudgets().add(mapper.toContract(iac));

            budgetQueueRepository.addToQue(request);

            return budgets;
        } else {

            final List<Budget> resultList = new ArrayList<Budget>();

            for (final Budget iac : budgets)
                resultList.add(update(iac));

            final BudgetRequest request = new BudgetRequest();
            request.setRequestInfo(requestInfo);
            request.setBudgets(new ArrayList<>());

            for (final Budget iac : resultList)
                request.getBudgets().add(mapper.toContract(iac));

            budgetQueueRepository.addToSearchQue(request);

            return resultList;
        }

    }

    @Autowired public  BudgetRepository(BudgetJdbcRepository budgetJdbcRepository, BudgetQueueRepository budgetQueueRepository,
                            @Value("${persist.through.kafka}") String persistThroughKafka,FinancialConfigurationContractRepository financialConfigurationContractRepository,
                            BudgetESRepository budgetESRepository);

}