implementing a dump to file