public function is_used_in_context($typeid, $courseid) {
        global $DB;

        $ok = $DB->record_exists('lti', array('course' => $courseid, 'typeid' => $typeid));
        return $ok || $DB->record_exists('lti_types', array('course' => $courseid, 'id' => $typeid));
    }