         KakapoServer.routes[urlString] = (.PUT, handler)
     }
     
+    private func toData(object: Any) -> NSData? {
+        switch object {
+        case let object as [String: Any]:
+            return object.toData()
+        case let object as [Any]:
+            return object.toData()
+        default:
+            return nil
+        }
+    }
+    
 }

        for (k, v) in pairs {
            self[k] = v
        }
    }
}


        // TODO: handle status codes and header fields
        let response = NSHTTPURLResponse(URL: request.URL!, statusCode: 200, HTTPVersion: "", headerFields: nil)
        client.URLProtocol(self, didReceiveResponse: response!, cacheStoragePolicy: .AllowedInMemoryOnly)
        
        if let data = toData(serializableObjects?.serialize()) {
            client.URLProtocol(self, didLoadData: data)
        }
        
