public function cache($qubaids) {
        global $DB;
        $toinsert = new \stdClass();
        $toinsert->hashcode = $qubaids->get_hash_code();
        $toinsert->timemodified = time();
        foreach ($this->fieldsindb as $field) {
            $toinsert->{$field} = $this->{$field};
        }
        $DB->insert_record('question_statistics', $toinsert, false);

        if ($this->get_variants()) {
            foreach ($this->variantstats as $variantstat) {
                $variantstat->cache($qubaids);
            }
        }
    }