     /**
      Fetches every instance of a given class that matches the predicate using the given managed object context. Includes subentities.
      NOT threadsafe! Always use a temp context if you are NOT on the main queue.
-
+     
      - parameter objectClass: The class of objects to fetch
      - parameter predicate: The predicate limit the fetch (defaults to nil)
      - parameter sortedBy: The sort descriptors to sort the results (defaults to nil)

     - returns: A new instance of the given class
     */
    public func managedObject<T: NSManagedObject>(ofClass objectClass: T.Type,
        inContext context: NSManagedObjectContext? = nil) -> T {
            guard let result = self.managedObject(of: objectClass, in: context) as? T else {
                fatalError("Could not cast NSManagedObject to \(String(describing: T.self))")
            }
            return result
    }
    
    /**

     - returns: A typed Array of created or updated objects
     */
    public func importArray<T: NSManagedObject>(_ inputArray: [[String : Any]],
                            of objectClass: T.Type,
                            withContext context: NSManagedObjectContext? = nil) -> [T] {
        guard let result = self.import(inputArray,
                                       for: objectClass,
                                       with: context) as? [T] else {
                                        fatalError("Could not cast array of NSManagedObjects into \(String(describing: T.self))")
        }
        return result
    }
    
    
