Serializing object directly