Map<String, dynamic> toMap() { return { if (eventName != null) 'eventName': eventName, if (metadata != null) 'metadata': metadata, }; }