Add serialize and deserialize method to Transaction object.