public EventDefinitionDto duplicate(EventDefinitionDto eventDefinition, Optional<User> user) {
        var copy = eventDefinition.toBuilder()
                .id(null)
                .title("COPY-" + eventDefinition.title())
                .remediationSteps(eventDefinition.remediationSteps())
                .scope(DefaultEntityScope.NAME)
                .state(EventDefinition.State.DISABLED)
                .build();

        return createWithoutSchedule(copy, user);
    }
@Test
    public void duplicate() {
        final EventDefinitionDto newDto = EventDefinitionDto.builder()
                .title("Test")
                .description("A test event definition")
                .config(TestEventProcessorConfig.builder()
                        .message("This is a test event processor")
                        .searchWithinMs(300000)
                        .executeEveryMs(60001)
                        .build())
                .priority(3)
                .state(EventDefinition.State.ENABLED)
                .scope(TestEntityScope.NAME)
                .alert(false)
                .notificationSettings(EventNotificationSettings.withGracePeriod(60000))
                .keySpec(ImmutableList.of("a", "b"))
                .notifications(ImmutableList.of())
                .build();

        final var existingEvent = eventDefinitionService.save(newDto);
        final var duplicated = handler.duplicate(existingEvent, Optional.empty());
        final var saved = eventDefinitionService.get(duplicated.id()).get();

        assertThat(saved.title()).startsWith("COPY-");
        assertThat(saved.scope()).isEqualTo(DefaultEntityScope.NAME);
        assertThat(saved.state()).isEqualTo(EventDefinition.State.DISABLED);

        assertThat(jobDefinitionService.getByConfigField("event_definition_id", saved.id())).isNotPresent();
    }