public static function can_all_be_deleted($ids) {
        global $CFG;

        if (empty($ids)) {
            return true;
        }
        // Check if competency is used in template.
        if (template_competency::has_records_for_competencies($ids)) {
            return false;
        }
        // Check if competency is used in plan.
        if (plan_competency::has_records_for_competencies($ids)) {
            return false;
        }
        // Check if competency is used in course.
        if (course_competency::has_records_for_competencies($ids)) {
            return false;
        }
        // Check if competency is used in user_competency.
        if (user_competency::has_records_for_competencies($ids)) {
            return false;
        }
        // Check if competency is used in user_competency_plan.
        if (user_competency_plan::has_records_for_competencies($ids)) {
            return false;
        }

        require_once($CFG->libdir . '/badgeslib.php');
        // Check if competency is used in a badge.
        if (badge_award_criteria_competency_has_records_for_competencies($ids)) {
            return false;
        }

        return true;
    }