extension Optional where Wrapped == Double {
    var asNSNumber : NSNumber? {
        if let val = self {
            return NSNumber(floatLiteral: val)
        } else {
            return nil
        }
    }
}