Converts the object to bytes using Borsh serialization.
List<int> toBytes() { return layout.serialize(serialize()); }