Map<String, dynamic> toJson() => byType.map( (key, value) => MapEntry(key.name, value.map((e) => e.toJson()).toList()), );