class ResourceReferenceConverter {

    protected Resource validateAndGetReference(String referenceUri, String ownersUri) throws IllegalParameterValueException {
        if (referenceUri == null) {
            throw new MandatoryParameterNotFoundException("resourceReference.uri");
        }

        if (!isAssignable(ownersUri, referenceUri)){
            throw new IllegalParameterValueException("resourceReference.uri", referenceUri);
        }
        // we need to update reference
        // but first check if URI is valid before fetching it
        if (referenceUri.isEmpty() || !referenceUri.startsWith(Folder.SEPARATOR)) {
            throw new ReferencedResourceNotFoundException(referenceUri, "uri");
        }

        final Resource resource = repositoryService.getResource(ExecutionContextImpl.getRuntimeExecutionContext(), referenceUri);
        if (resource == null) {
            // resource with such URI doesn't exist
            throw new ReferencedResourceNotFoundException(referenceUri, "uri");
        } else if (!restrictions.isEmpty()) {
            final ClientResource clientTargetObject = resourceConverterProvider.getToClientConverter(resource).toClient(resource, null);
            for (ClientReferenceRestriction restriction : restrictions) {
                restriction.validateReference(clientTargetObject);
            }
        }
        return resource;
    }

    public  ResourceReferenceConverter(ResourceConverterProvider resourceConverterProvider,
            RepositoryService repositoryService, PermissionsService permissionsService, RepositoryConfiguration configuration, ClientReferenceRestriction... restriction);

}