protected function update_feedback_files(int $historyid = null) {
        global $CFG;

        // We only support feedback files for modules atm.
        if ($this->grade_item && $this->grade_item->is_external_item()) {
            $context = $this->get_context();

            $fs = new file_storage();
            $fs->delete_area_files($context->id, GRADE_FILE_COMPONENT, GRADE_FEEDBACK_FILEAREA, $this->id);

            $this->copy_feedback_files($context, GRADE_FEEDBACK_FILEAREA, $this->id);

            if (empty($CFG->disablegradehistory) && $historyid) {
                $this->copy_feedback_files($context, GRADE_HISTORY_FEEDBACK_FILEAREA, $historyid);
            }
        }

        return true;
    }