Map<String, dynamic> toJson() { return { 'connections': connections.map((k, v) => MapEntry(k, v.toJson())), }; }