void (final Template template, Disposable parentDisposable) { final TemplateSettings settings = TemplateSettings.getInstance(); settings.addTemplate(template); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { settings.removeTemplate(template); } }); }