@Override
    public Optional<NativeEntity<GrokPattern>> findExisting(Entity entity, Map<String, ValueReference> parameters) {
        if (entity instanceof EntityV1) {
            return findExisting((EntityV1) entity);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());
        }
    }
@Test
    public void findExisting() throws ValidationException {
        final GrokPattern grokPattern = grokPatternService.save(GrokPattern.create("Test", "[a-z]+"));
        final Entity grokPatternEntity = EntityV1.builder()
                .id(ModelId.of("1"))
                .type(ModelTypes.GROK_PATTERN_V1)
                .data(objectMapper.convertValue(GrokPatternEntity.create("Test","[a-z]+"), JsonNode.class))
                .build();
        final Optional<NativeEntity<GrokPattern>> existingGrokPattern = facade.findExisting(grokPatternEntity, Collections.emptyMap());
        final NativeEntityDescriptor expectedDescriptor = NativeEntityDescriptor.create(grokPatternEntity.id(), "1", ModelTypes.GROK_PATTERN_V1, grokPattern.name(), false);
        assertThat(existingGrokPattern)
                .isPresent()
                .get()
                .satisfies(nativeEntity -> {
                    assertThat(nativeEntity.descriptor()).isEqualTo(expectedDescriptor);
                    assertThat(nativeEntity.entity()).isEqualTo(grokPattern);
                });
    }