Writing a custom data marshaller