protected void saveAndRunJobFilters(List<Job> jobs) {
        if (jobs.isEmpty()) return;

        try {
            jobFilterUtils.runOnStateElectionFilter(jobs);
            storageProvider.save(jobs);
            jobFilterUtils.runOnStateAppliedFilters(jobs);
        } catch (ConcurrentJobModificationException concurrentJobModificationException) {
            try {
                backgroundJobServer.getConcurrentJobModificationResolver().resolve(concurrentJobModificationException);
            } catch (UnresolvableConcurrentJobModificationException unresolvableConcurrentJobModificationException) {
                throw new SevereJobRunrException("Could not resolve ConcurrentJobModificationException", unresolvableConcurrentJobModificationException);
            }
        }
    }
@Test
    void ifNoStateChangeHappensStateChangeFiltersAreNotInvoked() {
        Job aJobInProgress = aJobInProgress().build();

        for (int i = 0; i <= 5; i++) {
            task.saveAndRunJobFilters(singletonList(aJobInProgress));
        }

        assertThat(logAllStateChangesFilter.getStateChanges(aJobInProgress)).isEmpty();
        assertThat(logAllStateChangesFilter.onProcessingIsCalled(aJobInProgress)).isFalse();
        assertThat(logAllStateChangesFilter.onProcessingSucceededIsCalled(aJobInProgress)).isFalse();
    }