     }
     
     func comparison<T: NSManagedObject>() -> T {
-        if let object = managedObjectModel()?.comparisonEntityDescriptions[NSStringFromClass(T.self)] as? T {
-            return object
+        if let object = managedObjectModel()?.comparisonEntityDescriptions[NSStringFromClass(T.self)] {
+            return unsafeBitCast(object, T.self)
         }
         let object = T(entity: self.entityDescription(T)!.comparisonEntityDescription(), insertIntoManagedObjectContext: nil)
         managedObjectModel()?.comparisonEntityDescriptions[NSStringFromClass(T.self)] = object

            return associatedValueOrDefault(&comparisonMapKey, defaultValue: [:])
        }
        set {
            objc_setAssociatedObject(self, &comparisonMapKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
        }
    }
}

            if $0 is NSAttributeDescription {
                propertyDescription.defaultValue = String.codingProperty(Property(keyPath: keyPath))
            } else if let relationshipDescription = $0 as? NSRelationshipDescription {
                propertyDescription.defaultValue = NSSet(array: [self.relationshipObject(relationshipDescription, keyPath: keyPath)])
            }
            return propertyDescription
        }
        return entityDescription
    }
    
    func relationshipObject(relationshipDescription: NSRelationshipDescription, keyPath: String) -> NSManagedObject {
        if let object = self.relationshipObjects[keyPath] {
            return object
        }
        let object = NSManagedObject(entity: relationshipDescription.destinationEntity!.relationshipEntityDescription(keyPath).relationshipEntityDescription(keyPath), insertIntoManagedObjectContext: nil)
        self.relationshipObjects[keyPath] = object
        return object
    }
    
    func relationshipEntityDescription(keyPath: String) -> NSEntityDescription {
