Converting NSManagedObject to NSDictionary (and back again).