@Override
    public Optional<NativeEntity<Collector>> findExisting(Entity entity, Map<String, ValueReference> parameters) {
        if (entity instanceof EntityV1) {
            return findExisting((EntityV1) entity, parameters);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());
        }
    }
@Test
    @MongoDBFixtures("SidecarCollectorFacadeTest.json")
    public void findExisting() {
        final Entity entity = EntityV1.builder()
                .id(ModelId.of("0"))
                .type(ModelTypes.SIDECAR_COLLECTOR_V1)
                .data(objectMapper.convertValue(SidecarCollectorEntity.create(
                        ValueReference.of("filebeat"),
                        ValueReference.of("exec"),
                        ValueReference.of("linux"),
                        ValueReference.of("/usr/lib/graylog-sidecar/filebeat"),
                        ValueReference.of("-c %s"),
                        ValueReference.of("test config -c %s"),
                        ValueReference.of("")), JsonNode.class))
                .build();

        final NativeEntity<Collector> existingCollector = facade.findExisting(entity, Collections.emptyMap())
                .orElseThrow(AssertionError::new);

        final Collector collector = collectorService.findByName("filebeat");
        assertThat(collector).isNotNull();

        final NativeEntityDescriptor expectedDescriptor = NativeEntityDescriptor.create(entity.id(), collector.id(), ModelTypes.SIDECAR_COLLECTOR_V1, collector.name(), false);
        assertThat(existingCollector.descriptor()).isEqualTo(expectedDescriptor);
        assertThat(existingCollector.entity()).isEqualTo(collector);
    }