class BankBranchService {

	public List<BankBranch> fetchRelated(List<BankBranch> bankbranches) {
		for (BankBranch bankBranch : bankbranches) {
			// fetch related items
			bankBranch.setTenantId(ApplicationThreadLocals.getTenantId().get());
			if (bankBranch.getTenantId() != null)
				if (bankBranch.getBank() != null && bankBranch.getBank().getId() != null) {
					bankBranch.getBank().setTenantId(bankBranch.getTenantId());
					Bank bank = bankRepository.findById(bankBranch.getBank());
					if (bank == null) {
						throw new InvalidDataException("bank", "bank.invalid", " Invalid bank");
					}
					bankBranch.setBank(bank);
				}

		}

		return bankbranches;
	}

}