public function add_all(array $items) : array {
        global $DB;
        $time = time();
        foreach ($items as $item) {
            $this->validate($item);
            $favourite = (array)$item;
            $favourite['timecreated'] = $time;
            $favourite['timemodified'] = $time;
            $ids[] = $DB->insert_record($this->favouritetable, $favourite);
        }
        list($insql, $params) = $DB->get_in_or_equal($ids);
        $records = $DB->get_records_select($this->favouritetable, "id $insql", $params);
        return $this->get_list_of_favourites_from_records($records);
    }