private void deleteRule(final DataRetentionRule rule) {
        if (rule != null) {
            final String nameStr = rule.getName() != null && !rule.getName().isEmpty()
                    ? " \"" + rule.getName() + "\""
                    : "";
            ConfirmEvent.fire(
                    this,
                    "Are you sure you want to delete rule "
                    + rule.getRuleNumber()
                    + nameStr + "?",
                    ok -> {
                        if (ok) {
                            if (!isDefaultRule(rule)) {
                                visibleRules.remove(rule);

                                update();
                                setDirty(true);

                                // Select the next rule.
                                int index = visibleRules.indexOf(rule);
                                if (index > 0) {
                                    index--;
                                }
                                if (index < visibleRules.size()) {
                                    listPresenter.getSelectionModel().setSelected(visibleRules.get(index));
                                } else {
                                    listPresenter.getSelectionModel().clear();
                                }
                            }
                        }
                    });
        }
    }
@return The rules created by the users, ignoring the default retain all rule
stroom-core-client/src/main/java/stroom/receive/rules/client/presenter/DataRetentionPolicyPresenter.java