initial implementation of SerializeToFile