public function find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) : favourite {
        global $DB;
        // Favourites model: We know that only one favourite can exist based on these properties.
        $record = $DB->get_record($this->favouritetable, [
            'userid' => $userid,
            'component' => $component,
            'itemtype' => $itemtype,
            'itemid' => $itemid,
            'contextid' => $contextid
        ], '*', MUST_EXIST);
        return $this->get_favourite_from_record($record);
    }