public function store($data) {

        // Delete previous file if it exists.
        $fs = get_file_storage();

        $filerecord = [
            'component' => 'analytics',
            'filearea' => $this->filearea,
            'itemid' => $this->modelid,
            'contextid' => \context_system::instance()->id,
            'filepath' => '/analysable/' . $this->analysableid . '/' .
                \core_analytics\analysis::clean_time_splitting_id($this->timesplittingid) . '/',
            'filename' => self::get_filename($this->evaluation)
        ];

        // Delete previous and old (we already checked that previous copies are not recent) evaluation files for this analysable.
        if ($this->evaluation) {
            $select = " = {$filerecord['itemid']} AND filepath = :filepath";
            $fs->delete_area_files_select($filerecord['contextid'], $filerecord['component'], $filerecord['filearea'],
                $select, array('filepath' => $filerecord['filepath']));
        }

        // Write all this stuff to a tmp file.
        $filepath = make_request_directory() . DIRECTORY_SEPARATOR . $filerecord['filename'];
        $fh = fopen($filepath, 'w+');
        if (!$fh) {
            return false;
        }
        foreach ($data as $line) {
            fputcsv($fh, $line);
        }
        fclose($fh);

        return $fs->create_file_from_pathname($filerecord, $filepath);
    }