     }
 
     func testCreateWithNestedObjects() {
-        let standalone = SwiftPrimaryStringObject(object: ["11", 11])
-        Realm().beginWrite()
-        let objectWithNestedObjects = Realm().create(SwiftLinkToPrimaryStringObject.self, value: ["11", ["11", 11], [standalone]])
+        let standalone = SwiftPrimaryStringObject(object: ["primary", 11])
+        Realm().beginWrite()
+        let objectWithNestedObjects = Realm().create(SwiftLinkToPrimaryStringObject.self, value: ["primary", ["primary", 11], [standalone]])
         Realm().commitWrite()
 
         let stringObjects = Realm().objects(SwiftPrimaryStringObject)
         XCTAssertEqual(stringObjects.count, 1)
         let persistedObject = stringObjects.first!
 
-        XCTAssertNotEqual(standalone, persistedObject)
+        XCTAssertNotEqual(standalone, persistedObject) // standalone object should be copied into the realm, not added directly
         XCTAssertEqual(objectWithNestedObjects.object!, persistedObject)
         XCTAssertEqual(objectWithNestedObjects.objects.first!, persistedObject)
     }
 
     func testUpdateWithNestedObjects() {
-        let standalone = SwiftPrimaryStringObject(object: ["11", 11])
-        Realm().beginWrite()
-        let object = Realm().create(SwiftLinkToPrimaryStringObject.self, value: ["12", standalone, [["11", 12]]], update: true)
+        let standalone = SwiftPrimaryStringObject(object: ["primary", 11])
+        Realm().beginWrite()
+        let object = Realm().create(SwiftLinkToPrimaryStringObject.self, value: ["otherPrimary", standalone, [["primary", 12]]], update: true)
         Realm().commitWrite()
 
         let stringObjects = Realm().objects(SwiftPrimaryStringObject)


    func testAddAndUpdateWithExisingNestedObjects() {
        Realm().beginWrite()
        let existingObject = Realm().create(SwiftPrimaryStringObject.self, value: ["1", 1])
        Realm().commitWrite()

        Realm().beginWrite()
        let object = SwiftLinkToPrimaryStringObject(object: ["1", ["1", 2], []])
        Realm().add(object, update: true)
        Realm().commitWrite()

        XCTAssertNotNil(object.realm)
        XCTAssertEqual(object.object!, existingObject)
        XCTAssertEqual(existingObject.intCol, 2)
    }



    func testUpdateWithObjectsFromAnotherRealm() {
        realmWithTestPath().beginWrite()
        let otherRealmObject = realmWithTestPath().create(SwiftLinkToPrimaryStringObject.self, value: ["primary", NSNull(), [["2", 2], ["4", 4]]])
        realmWithTestPath().commitWrite()

        Realm().beginWrite()
        Realm().create(SwiftLinkToPrimaryStringObject.self, value: ["primary", ["10", 10], [["11", 11]]])
        let object = Realm().create(SwiftLinkToPrimaryStringObject.self, value: otherRealmObject, update: true)
        Realm().commitWrite()

        XCTAssertNotEqual(otherRealmObject, object) // the object from the other realm should be copied into this realm
    }

    // test NSNull for object
