Map<String, Object?> toJson() { final data = <String, Object?>{}; if (inviteState != null) { data['invite_state'] = { 'events': inviteState!.map((i) => i.toJson()).toList(), }; } return data; }