public function build(
        stdClass $user,
        forum_entity $forum,
        discussion_entity $discussion
    ) : array {

        $favouriteids = [];
        if ($this->is_favourited($discussion, $forum->get_context(), $user)) {
            $favouriteids[] = $discussion->get_id();
        }

        $groupsbyid = $this->get_groups_available_in_forum($forum);
        $discussionexporter = $this->exporterfactory->get_discussion_exporter(
            $user, $forum, $discussion, $groupsbyid, $favouriteids
        );

        return (array) $discussionexporter->export($this->renderer);
    }