      Initializes a DataStack using the provided model name.
      - parameter modelName: The name of your Core Data model (xcdatamodeld).
      */
-    @objc public init(modelName: String) {
+    @objc public init?(modelName: String) {
+        
+        guard let model = NSManagedObjectModel(bundle: self.modelBundle, name: self.modelName) else { return nil }
+        
         self.modelName = modelName
-        self.model = NSManagedObjectModel(bundle: self.modelBundle, name: self.modelName)
+        self.model = model
 
         super.init()
     }

    ///   - context: The context against which request should be executed.
    /// - Returns: An array containing managed objects, managed object IDs, or dictionaries as appropriate for a fetch request; an empty array if request is a save request, or nil if an error occurred.
    /// - Throws: If an error occurs, upon return contains an NSError object that describes the problem.
    @objc public func execute(_ request: NSPersistentStoreRequest, with context: NSManagedObjectContext) throws -> Any {
        return try self.persistentStoreCoordinator.execute(request, with: context)
    }

    // Can't be private, has to be internal in order to be used as a selector.

}

extension NSManagedObjectModel {
    convenience init?(bundle: Bundle, name: String) {
        if let momdModelURL = bundle.url(forResource: name, withExtension: "momd") {
            self.init(contentsOf: momdModelURL)
        } else if let momModelURL = bundle.url(forResource: name, withExtension: "mom") {
            self.init(contentsOf: momModelURL)
        } else {
            self.init()
        }
