public void unschedule(String eventDefinitionId) {
        final EventDefinitionDto eventDefinition = getEventDefinitionOrThrowIAE(eventDefinitionId);

        if (SystemNotificationEventEntityScope.NAME.equals(eventDefinition.scope())) {
            LOG.debug("Ignoring disable for system notification events");
            return;
        }

        getJobDefinition(eventDefinition)
                .ifPresent(jobDefinition -> deleteJobDefinitionAndTrigger(jobDefinition, eventDefinition));
        eventDefinitionService.updateState(eventDefinitionId, EventDefinition.State.DISABLED);
    }
@Test
    @MongoDBFixtures("event-processors.json")
    public void unschedule() {
        assertThat(eventDefinitionService.get("54e3deadbeefdeadbeef0000")).isPresent();
        assertThat(jobDefinitionService.get("54e3deadbeefdeadbeef0001")).isPresent();
        assertThat(jobTriggerService.get("54e3deadbeefdeadbeef0002")).isPresent();

        handler.unschedule("54e3deadbeefdeadbeef0000");

        // Unschedule should NOT delete the event definition!
        assertThat(eventDefinitionService.get("54e3deadbeefdeadbeef0000")).isPresent();

        // Only the job definition and the trigger
        assertThat(jobDefinitionService.get("54e3deadbeefdeadbeef0001")).isNotPresent();
        assertThat(jobTriggerService.get("54e3deadbeefdeadbeef0002")).isNotPresent();
    }