@Override
    public Optional<ProfileDescription> compare(final ProfileDescription next) {
        // Filter out profiles with matching checksum
        final Optional<ProfileDescription> found = repository.stream()
            .filter(description -> Objects.equals(description.getChecksum(), next.getChecksum()))
            .findFirst();
        if(found.isPresent()) {
            // Found matching checksum. Determine if latest version
            if(found.get().isLatest()) {
                // Latest version already installed
                return Optional.empty();
            }
            else {
                // Read last profile version from server as we found matching checksum for previous version
                return found;
            }
        }
        log.warn(String.format("Local only profile %s", next));
        return Optional.empty();
    }
@Test
    public void testEqual() throws Exception {
        // Managed profile
        final ProfileDescription remote = new ProfileDescription(
                ProtocolFactory.get(), new Checksum(HashAlgorithm.md5, "d41d8cd98f00b204e9800998ecf8427e"), null) {
            @Override
            public boolean isLatest() {
                return true;
            }
        };
        final ProfileDescription local = new ProfileDescription(
                ProtocolFactory.get(), new Checksum(HashAlgorithm.md5, "d41d8cd98f00b204e9800998ecf8427e"), null);
        assertFalse(new ChecksumProfileMatcher(Stream.of(remote).collect(Collectors.toSet())).compare(local).isPresent());
    }