Should be `if (app != null) Entities.destroyAll(app.getManagementContext())`