class InstrumentAccountCodeRepository {

    @Transactional
    public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo) {

        InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper();

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

            InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest();
            request.setRequestInfo(requestInfo);
            request.setInstrumentAccountCodes(new ArrayList<>());

            for (InstrumentAccountCode iac : instrumentAccountCodes)
                request.getInstrumentAccountCodes().add(mapper.toContract(iac));

            instrumentAccountCodeQueueRepository.addToQue(request);

            return instrumentAccountCodes;
        } else {

            List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>();

            for (InstrumentAccountCode iac : instrumentAccountCodes)
                resultList.add(delete(iac));

            InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest();
            request.setRequestInfo(requestInfo);
            request.setInstrumentAccountCodes(new ArrayList<>());

            for (InstrumentAccountCode iac : resultList)
                request.getInstrumentAccountCodes().add(mapper.toContract(iac));

            instrumentAccountCodeQueueRepository.addToSearchQue(request);

            return resultList;
        }

    }

    @Autowired public  InstrumentAccountCodeRepository(InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository,
            InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            InstrumentAccountCodeESRepository instrumentAccountCodeESRepository,
            FinancialConfigurationContractRepository financialConfigurationContractRepository);

}