     
     /// Returns `true` if the Set contains `element`.
     func contains(_ element: Element) -> Bool {
-        return contents[element.id] != nil
+        guard let id = element.id else { return false }
+        return contents[id] != nil
     }
     
     subscript(id: ID) -> Element? {

    public init(arrayLiteral elements: Element...) {
        self.init(elements)
    }
}

// Hoping to use this to implement function.apply
// we used to have this in other programming languages
@discardableResult func apply<T, U>(fn: (T...) -> U, args: [T]) -> U {
    typealias FunctionType = ([T]) -> U
    return unsafeBitCast(fn, to: FunctionType.self)(args)
}

extension RecordSet {

// MARK: RecordSet Easier initialization
extension RecordSet {
    init<S: Sequence>(_ sequence: S) where S.Iterator.Element == Element {
        sequence.forEach {
            if let id = $0.id {
                contents[id] = $0
            }
        }
    }
}

