CSV import and export based on https://github.com/thephpleague/csv/