 }
 
 public func ==(lhs: AnyType?, rhs: AnyType?) -> Bool {
-    if lhs?.rawType == rhs?.rawType {
-        switch lhs!.rawType {
-        case "String": return (lhs as! String) == (rhs as! String)
-        case "Int": return (lhs as! Int) == (rhs as! Int)
-        case "Float": return (lhs as! Float) == (rhs as! Float)
-        default: return false
-        }
-    }
-    return false
+    if let left = lhs {
+        if let right = rhs {
+            if left.rawType != right.rawType { return false }
+            switch left.rawType {
+            case "String": return (left as! String) == (right as! String)
+            case "Int": return (left as! Int) == (right as! Int)
+            case "Float": return (left as! Float) == (right as! Float)
+            case "ActiveRecord": return (left as! ActiveRecord).hashValue == (right as! ActiveRecord).hashValue
+            default: return false
+            }
+        }
+        return false
+    }
+    return true
 }
 
 extension String: AnyType {

            self.setAttrbiutes(newValue)
            ActiveSnapshotStorage.sharedInstance.set(self)
        }
    }
    public func setAttrbiutes(attributes: [String: Any?]) {}
    public func getAttributes() -> [String: Any?] {

    var rawType: String { return "Float" }
}

public protocol ActiveRecord: AnyType {
    var id: AnyType? {set get}
    init()
    init(attributes: [String:Any?])
