      
     */
     public static func register<P, T>(keys: Set<Key<T>>, metadata: Any = (), cached: Bool = false, resolution: @escaping Resolution<P, T>) -> Set<Key<T>> {
-        return Set(keys.map{ register(key: $0, metadata: metadata, cached: cached, resolution: resolution) })
+        return lock.write {
+            for key in keys {
+                registrations[AnyKey(key)] = Dependency(metadata: metadata, cached: cached, resolution: resolution)
+            }
+            return keys
+        }
     }
     
     /**

    public init<T, C: Hashable>(type: T.Type, container: C) {
        self.init(type: type, name: Name.default, container: container)
    }
}

extension Set where Element == AnyKey {
    public func typed<T>() -> Set<Key<T>> {
        return Set<Key<T>>(flatMap{ Key($0) })
    }

    return true
}

public struct Key<T>: TypedKey, Hashable {
    public let type: String
    public let name: AnyHashable
    public let container: AnyHashable
