if (!newEntity.getKind().equals(targetEntityKind)) {
throw new NotImplementedException("EdmNavigationProperty " + targetNavProp + " is not of expected kind. Expecting " + targetEntityKind + ", got " + newEntity.getKind() + ".");
}
}
EdmMultiplicity multiplicity = ees.getType().findNavigationProperty(targetNavProp).getToRole().getMultiplicity();
if (multiplicity == EdmMultiplicity.ZERO_TO_ONE) {
entity.setProperty(targetNavProp, newEntity != null ? newEntity.getKey() : null);
} else {
@SuppressWarnings("unchecked")
Collection<Key> keys = (Collection<Key>) entity.getProperty(targetNavProp);