Serializes a UserId object into a byte array.
a byte array representing the serialized UserId object
the UserId object to serialize
if an I/O error occurs during serialization