Added serializing function to User