try {
if (filter) {
if (criteria.hasEventIdCriteria()) {
Set<String> idsFilteredByEvents = filterByEvents(criteria);
if (activeFilter) {
<BUG>eventIds.retainAll(idsFilteredByEvents);
if (eventIds.isEmpty()) {</BUG>
return new Page<>(events, pager, 0);
<BUG>}
} else {
eventIds.addAll(idsFilteredByEvents);</BUG>
}

try {
if (filter) {
if (criteria.hasEventIdCriteria()) {
Set<String> idsFilteredByEvents = filterByEvents(criteria);
if (activeFilter) {
eventIds.retainAll(idsFilteredByEvents);
} else {
eventIds.addAll(idsFilteredByEvents);
}
if (eventIds.isEmpty()) {
return new Page<>(events, pager, 0);
}
