Split the writing up into a writer and a serializer so the writer can write other things besides CSV files.