 but that crashes the compiler
 */
 
-extension Array where T: Structured, T == T.StructureType {
+extension Array where T: Unboxing, T == T.StructureType {
     public static func unbox(value: AnyObject) -> Unboxed<[T]> {
         switch value {
-        case let v as NSOrderedSet:
-            return Unboxed.Success([T.unbox(v.firstObject!).value!])
+        case let orderedSet as NSOrderedSet:
+            var container: [T] = []
+            // Each entry has to be unboxed seperately and then the unboxed
+            // value will be in an 'Unboxed' array. Also, unboxing may always fail
+            for boxedEntry in orderedSet {
+                if let value = T.unbox(boxedEntry).value {
+                    container.append(value)
+                }
+            }
+            return Unboxed.Success(container)
         default: return Unboxed.TypeMismatch("Array")
         }
     }
 }
 
-extension Int: Structured {
+extension Int: Unboxing, Boxing {
     public static func unbox(value: AnyObject) -> Unboxed<Int> {
         switch value {
         case let v as NSNumber: return Unboxed.Success(v.integerValue)

                continue
            }
            
            // FIXME: This still looks awful. Need to spend more time cleaning this up
            if let value = valueMaybe as? _Structured {
                try value.box(result, withKey: label)
            } else {
                let valueMirror:MirrorType = reflect(valueMaybe)
                if valueMirror.count == 0 {
                    result.setValue(nil, forKey: label)
                } else {
                    // Since MirrorType has no typealias for it's children, we have to 
                    // unpack the first one in order to identify them
                    switch (valueMirror.count, valueMirror.disposition, valueMirror[0]) {
                    case (_, .Optional, (_, let some)) where some.value is AnyObject:
                        result.setValue(some.value as? AnyObject, forKey: label)
                    case (_, .IndexContainer, (_, let some)) where some.value is _Structured:
                        // Since valueMirror isn't an array type, we can't map over it or even properly extend it
                        var objects: [NSManagedObject] = []
                        for c in 0..<valueMirror.count {
                            if let value = valueMirror[c].1.value as? _Structured {
                                objects.append(try toCoreData(context)(entity: value))
                            }
                        }

    return a.apply(f)
}

public protocol Boxing {
    var EntityName: String {get}
    // Boxing can throw, as there may be no way to construct an NSObject representation of a struct type
    func box(object: NSManagedObject, withKey: String) throws
