public function is_used() {

        if (\tool_dataprivacy\contextlevel::is_category_used($this->get('id')) ||
                \tool_dataprivacy\context_instance::is_category_used($this->get('id'))) {
            return true;
        }

        $pluginconfig = get_config('tool_dataprivacy');
        $levels = \context_helper::get_all_levels();
        foreach ($levels as $level => $classname) {

            list($unused, $categoryvar) = \tool_dataprivacy\data_registry::var_names_from_context($classname);
            if (!empty($pluginconfig->{$categoryvar}) && $pluginconfig->{$categoryvar} == $this->get('id')) {
                return true;
            }
        }

        return false;
    }