@Override
    public Optional<Entity> exportEntity(EntityDescriptor entityDescriptor, EntityDescriptorIds entityDescriptorIds) {
        final ModelId modelId = entityDescriptor.id();
        try {
            final GrokPattern grokPattern = grokPatternService.load(modelId.id());
            return Optional.of(exportNativeEntity(grokPattern, entityDescriptorIds));
        } catch (NotFoundException e) {
            LOG.debug("Couldn't find grok pattern {}", entityDescriptor, e);
            return Optional.empty();
        }
    }
@Test
    public void exportEntity() throws ValidationException {
        grokPatternService.save(GrokPattern.create("Test1", "[a-z]+"));
        grokPatternService.save(GrokPattern.create("Test2", "[a-z]+"));

        final EntityDescriptor descriptor = EntityDescriptor.create("1", ModelTypes.GROK_PATTERN_V1);
        final EntityDescriptorIds entityDescriptorIds = EntityDescriptorIds.of(descriptor);
        final Map<String, Object> entity = ImmutableMap.of(
                "name", "Test1",
                "pattern", "[a-z]+");
        final JsonNode entityData = objectMapper.convertValue(entity, JsonNode.class);

        final Optional<Entity> collectedEntity = facade.exportEntity(descriptor, entityDescriptorIds);
        assertThat(collectedEntity)
                .isPresent();
        final EntityV1 entityV1 = (EntityV1) collectedEntity.get();
        assertThat(entityV1.id()).isEqualTo(ModelId.of(entityDescriptorIds.get(descriptor).orElse(null)));
        assertThat(entityV1.type()).isEqualTo(ModelTypes.GROK_PATTERN_V1);
        assertThat(entityV1.data()).isEqualTo(entityData);
    }