Converts object to map.
Map<String, dynamic> toMap() { List<Map<String, dynamic>> componentsMaps = components.map((c) => c.toMap()).toList(); return { 'components': componentsMaps, }; }