public static function downloadDataAsCsvFile($data)
    {
        ob_clean();
        header("Content-Type: text/csv");
        header("Content-Disposition: attachment; filename=file.csv");
        // Disable caching
        header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
        header("Pragma: no-cache"); // HTTP 1.0
        header("Expires: 0"); // Proxies

        $output = fopen("php://output", "w");

        $first = reset($data);
        if ($first && is_array($first)) {
            // Keys as headers
            fputcsv($output, array_keys($first), ';');
        }

        // Rows with data
        foreach ($data as $row) {
            fputcsv($output, $row, ';');
        }

        exit;
    }