@Override
    public NativeEntity<Collector> createNativeEntity(Entity entity,
                                                      Map<String, ValueReference> parameters,
                                                      Map<EntityDescriptor, Object> nativeEntities,
                                                      String username) {
        if (entity instanceof EntityV1) {
            return decode((EntityV1) entity, parameters);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());
        }
    }
@Test
    public void createNativeEntity() {
        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();

        assertThat(collectorService.count()).isEqualTo(0L);

        final NativeEntity<Collector> nativeEntity = facade.createNativeEntity(entity, Collections.emptyMap(), Collections.emptyMap(), "username");
        assertThat(collectorService.count()).isEqualTo(1L);

        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(nativeEntity.descriptor()).isEqualTo(expectedDescriptor);
        assertThat(nativeEntity.entity()).isEqualTo(collector);
    }