Serialise and deserialise things to binary