Map<String, dynamic> toMap() { Map<String, dynamic> f = {}; fields.forEach((key, value) { if (value is DateTime) { f[key] = value.toString(); } else { f[key] = value; } }); return f; }