protected function store_combined_file($tmpfile, $contextid, $itemid, $partial = false) {
        // Store the file.
        $record = $this->get_stored_file_record($contextid, $itemid, $partial);
        $fs = get_file_storage();

        // Delete existing files first.
        $fs->delete_area_files($record->contextid, $record->component, $record->filearea, $record->itemid);

        // This was a combined pdf.
        $file = $fs->create_file_from_pathname($record, $tmpfile);

        $this->set_combined_file($file);

        return $this;
    }