Example of serializing an object