public function get_available_saquestions_from_category($categoryid, $subcategories) {
        if (isset($this->availablesaquestionsbycategory[$categoryid][$subcategories])) {
            return $this->availablesaquestionsbycategory[$categoryid][$subcategories];
        }

        if ($subcategories) {
            $categoryids = question_categorylist($categoryid);
        } else {
            $categoryids = array($categoryid);
        }

        $questionids = question_bank::get_finder()->get_questions_from_categories(
                $categoryids, "qtype = 'shortanswer'");
        $this->availablesaquestionsbycategory[$categoryid][$subcategories] = $questionids;
        return $questionids;
    }