CodeValue collateralType = null;
final LoanCollateral collateralForUpdate = this.collateralRepository.findOne(collateralId);
if (collateralForUpdate == null) { throw new CollateralNotFoundException(loanId, collateralId); }
final Map<String, Object> changes = collateralForUpdate.update(command);
if (changes.containsKey(COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue())) {
collateralType = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(
CollateralApiConstants.COLLATERAL_CODE_NAME, collateralTypeId);