Map<String, dynamic> toJson() { return { 'network': network, 'metadata': metadata, }..removeWhere((key, value) => value == null); }