Add logic for NSManagedObject and NSManagedObjectID