Add serialization for methods