class AccountDetailTypeRepository {

	@Transactional
	public List<AccountDetailType> update(List<AccountDetailType> accountDetailTypes, RequestInfo requestInfo) {

		ModelMapper mapper = new ModelMapper();
		AccountDetailTypeContract contract;

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

			AccountDetailTypeRequest request = new AccountDetailTypeRequest();
			request.setRequestInfo(requestInfo);
			request.setAccountDetailTypes(new ArrayList<>());

			for (AccountDetailType f : accountDetailTypes) {

				contract = new AccountDetailTypeContract();
				contract.setCreatedDate(new Date());
				mapper.map(f, contract);
				request.getAccountDetailTypes().add(contract);

			}

			addToQue(request);

			return accountDetailTypes;
		} else {

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

			for (AccountDetailType f : accountDetailTypes) {

				resultList.add(update(f));
			}

			AccountDetailTypeRequest request = new AccountDetailTypeRequest();
			request.setRequestInfo(requestInfo);
			request.setAccountDetailTypes(new ArrayList<>());

			for (AccountDetailType f : resultList) {

				contract = new AccountDetailTypeContract();
				contract.setCreatedDate(new Date());
				mapper.map(f, contract);
				request.getAccountDetailTypes().add(contract);

			}

			addToSearchQueue(request);

			return resultList;
		}

	}

	@Autowired public  AccountDetailTypeRepository(AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository,
			MastersQueueRepository accountDetailTypeQueueRepository,
			FinancialConfigurationService financialConfigurationService,
			AccountDetailTypeESRepository accountDetailTypeESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka);

}