title: Swift CoreData - error in fetching results
body: <p>I need to have a method that check if a record exists in the Database. <strong>and it needs to be able to run in the background.</strong><br>
  I've followed <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/Concurrency.html" rel="nofollow">this link</a> to create a method to check if a record exists in DataBase or not. using CoreData of course.<br>
  and this is my code sample:</p>
  
  <pre><code>private let moc = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
  private func checkIfModelExistsByID(id: String, callback: CallbackBool) {
      let privateMOC = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
      privateMOC.parentContext = moc
      privateMOC.performBlock {
          let fetchRequest = NSFetchRequest(entityName: "Groups")
          let predicate = NSPredicate(format: "id == %@", id)
          fetchRequest.predicate = predicate
          fetchRequest.fetchLimit = 10
          do {
              let results = try privateMOC.executeFetchRequest(fetchRequest)
              if results.count &gt; 0 {
                  return callback(true)
              }
          } catch {
              fatalError("Failure to save context: \(error)")
          }
          callback(false)
      }
  }
  </code></pre>
  
  <h2>The Problem</h2>
  
  <p>when I call the method it says:  </p>
  
  <blockquote>
    <p><strong>nil is not a legal NSPersistentStoreCoordinator for searching for entity name 'Groups'</strong></p>
  </blockquote>