 }
 
 extension MSDocument {
+    public func metaAndLinkedSumDictionary() -> [String : Any] {
+        var dict = dictionary(metaOnly: true)
+        dict["linkedSum"] = linkedSum.minorUnits
+        return dict
+    }
+    
     public func dictionary(metaOnly: Bool = true) -> Dictionary<String, Any> {
         var dict = [String: Any]()
         dict["meta"] = meta.dictionary()
-        dict["linkedSum"] = linkedSum.minorUnits
+        
         guard !metaOnly else { return dict }
         
         dict.merge(info.dictionary())
         dict.merge(id.dictionary())
         
+        dict["linkedSum"] = linkedSum.minorUnits
         dict["sum"] = sum.minorUnits
         dict["agent"] = serialize(entity: agent, metaOnly: true)
         dict["contract"] = serialize(entity: contract, metaOnly: true)

        dict["shared"] = shared
        dict["applicable"] = applicable
        dict["state"] = serialize(entity: state, metaOnly: true)
        dict["attributes"] = attributes?.flatMap { $0.value() }.map { $0.dictionary(metaOnly: false) }
        if let agentAccount = agentAccount {
            dict["agentAccount"] = serialize(entity: agentAccount, metaOnly: true)
        }

                                    collectionName: "returns")
        dict["operations"] = serialize(entities: operations,
                                       parent: self,
                                       objectType: MSObjectType.customerorder,
                                       collectionName: "operations",
                                       serializeObject: { $0.metaAndLinkedSumDictionary() })
        dict["customerOrders"] = serialize(entities: customerOrders,
                                           parent: self,
                                           objectType: MSObjectType.customerorder, collectionName: "customerOrders")
