I suggest using to_file method of ContentData (message is actually an instance ContentData)