public static function writeCsvToStream(array $csvData, $handle)
    {
        if (is_null($handle)) {
            throw new InvalidArgumentException('File handle is null.');
        }

        foreach ($csvData as $line) {
            fputcsv($handle, $line);
        }
    }