class BudgetReAppropriationRepository {

    @Transactional
    public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo) {

        final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper();

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

            final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest();
            request.setRequestInfo(requestInfo);
            request.setBudgetReAppropriations(new ArrayList<>());

            for (final BudgetReAppropriation iac : budgetReAppropriations)
                request.getBudgetReAppropriations().add(mapper.toContract(iac));

            budgetReAppropriationQueueRepository.addToQue(request);

            return budgetReAppropriations;
        } else {

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

            for (final BudgetReAppropriation iac : budgetReAppropriations)
                resultList.add(delete(iac));

            final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest();
            request.setRequestInfo(requestInfo);
            request.setBudgetReAppropriations(new ArrayList<>());

            for (final BudgetReAppropriation iac : resultList)
                request.getBudgetReAppropriations().add(mapper.toContract(iac));

            budgetReAppropriationQueueRepository.addToSearchQue(request);

            return resultList;
        }

    }

    @Autowired public  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    );

}