class BankController {

	@PostMapping("/_update")
	@ResponseStatus(HttpStatus.CREATED)
	public BankResponse update(@RequestBody BankRequest bankRequest, BindingResult errors,@RequestParam String tenantId) {


		if (errors.hasErrors()) {
			throw new CustomBindException(errors);
		}
		bankRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE);
		ModelMapper model = new ModelMapper();
		BankResponse bankResponse = new BankResponse();
		List<Bank> banks = new ArrayList<>();
		bankResponse.setResponseInfo(getResponseInfo(bankRequest.getRequestInfo()));
		Bank bank;
		BankContract contract;
		List<BankContract> bankContracts = new ArrayList<>();

		for (BankContract bankContract : bankRequest.getBanks()) {
			bank = new Bank();
			model.map(bankContract, bank);
			bank.setLastModifiedBy(bankRequest.getRequestInfo().getUserInfo());
			bank.setLastModifiedDate(new Date());
			banks.add(bank);
		}

		banks = bankService.update(banks, errors, bankRequest.getRequestInfo());

		for (Bank bankObj : banks) {
			contract = new BankContract();
			model.map(bankObj, contract);
			bankObj.setLastModifiedDate(new Date());
			bankContracts.add(contract);
		}

		bankResponse.setBanks(bankContracts);

		return bankResponse;
	}

}