class AbstractContextualPreferenceHandler implements ContextualPreferenceHandler {

    @Override
    public boolean isValid(final ContextualPreference preference) {
        return preference.getResource().getLevel() == level
                ? externalEntityExists(preference)
                : validateUsingNextHandler(preference).orElse(false);
    }

      AbstractContextualPreferenceHandler(final ContextualPreferenceLevel level,
                                        final ContextualPreferenceHandler nextHandler);

}