             
             it("should serialize the top links inside single relationships") {
                 let object = json(user)
-                let data = object["relationships"]["dog"]["links"].dictionaryValue
-                expect(data.count).toNot(equal(0))
-                expect(data["anotherDog"]!["href"]).to(equal("http://example.com/articles/1/comments"))
-                expect(data["testDog"]).to(equal("hello"))
+                let links = object["relationships"]["dog"]["links"].dictionaryValue
+                expect(links.count).toNot(equal(0))
+                expect(links["anotherDog"]!["href"]).to(equal("http://example.com/articles/1/comments"))
+                expect(links["testDog"]).to(equal("hello"))
             }
             
             it("should serialize the top links inside multiple relationships") {
                 let object = json(user)
-                let data = object["relationships"]["cats"]["links"].dictionaryValue
-                expect(data.count).toNot(equal(0))
-                expect(data["prev"]).to(equal("hello"))
-                expect(data["next"]).to(equal("world"))
-                expect(data["first"]).to(equal("yeah"))
-                expect(data["last"]).to(equal("text"))
+                let links = object["relationships"]["cats"]["links"].dictionaryValue
+                expect(links.count).toNot(equal(0))
+                expect(links["prev"]).to(equal("hello"))
+                expect(links["next"]).to(equal("world"))
+                expect(links["first"]).to(equal("yeah"))
+                expect(links["last"]).to(equal("text"))
             }
             
             it("should serialize the links inside included objects") {
                 let object = json(JSONAPISerializer(user))
-                let data = object["included"][2]["links"].dictionaryValue
-                expect(data).toNot(beNil())
-                expect(data["test"]).to(equal("hello"))
-                expect(data["another"]!["href"]).to(equal("http://example.com/articles/1/comments"))
+                let included = object["included"].arrayValue
+                let cat2 = included.filter { (relationships) in
+                    if relationships.dictionaryValue["id"]!.intValue == 44 {
+                        return true
+                    }
+                    return false
+                }.first!
+                
+                
+                let links = cat2["links"].dictionaryValue
+                expect(links).toNot(beNil())
+                expect(links["test"]).to(equal("hello"))
+                expect(links["another"]!["href"]).to(equal("http://example.com/articles/1/comments"))
             }
             
             it("should serialize the links inside array of data objects") {
                 let object = json(JSONAPISerializer([user, user2]))
-                let firstData = object["data"][0]["links"]
-                let secondData = object["data"][0]["links"]
-                expect(firstData).toNot(beNil())
-                expect(secondData).toNot(beNil())
+                let firstLinks = object["data"][0]["links"]
+                let secondLinks = object["data"][0]["links"]
+                expect(firstLinks).toNot(beNil())
+                expect(secondLinks).toNot(beNil())
             }
             
             it("should not serialize nil links") {

            
            it("should serialize data with links") {
                let object = json(JSONAPISerializer(dog, topLinks: ["test": JSONAPILink.Simple(value: "hello")]))
                let data = object["data"]["links"].dictionaryValue
                expect(data.count).toNot(equal(0))
                expect(data["self"]).to(equal("selfish"))
            }
            
            it("should serialize top level links") {
                let object = json(JSONAPISerializer(dog, topLinks: ["test": JSONAPILink.Simple(value: "hello"), "another": JSONAPILink.Object(href: "http://example.com/articles/1/comments", meta: Meta())]))
                let data = object["links"].dictionaryValue
                expect(data.count).toNot(equal(0))
                expect(data["test"]).to(equal("hello"))
                expect(data["another"]!["href"]).to(equal("http://example.com/articles/1/comments"))
                expect(data["another"]!["meta"]["authors"][0]).to(equal("Yehuda Katz"))
            }
        }
        

            }
            
            it("should not serialize nil top links") {
                let userLinks = [
                    "one": JSONAPILink.Simple(value: "hello"),
                    "two": JSONAPILink.Object(href: "hello", meta: Meta())
                ]
                
                let newUser = NoCatsUser(id: "11",
                                         name: "Alex",
                                         dog: DogWithNoLinks(id: "213", name: "Hez", cat: cats[0]),
                                         links: userLinks)
                
                let object = json(newUser)
                let links = object["relationships"]["dog"]["links"]
                expect(links.count) == 0
            }
        }
    }
}
