             request.entity = NSEntityDescription.entityForName(kEntityName, inManagedObjectContext: context)
             let predicate = NSPredicate(format: "%K == %@", kModelNameAttributeName, modelName)
             request.predicate = predicate
-            var error:NSError?
             do {
                 let results = try context.executeFetchRequest(request)
                 for item in results {
                     context.deleteObject(item as! NSManagedObject)
                 }
-            } catch let error1 as NSError {
-                error = error1
+            } catch let error as NSError {
+                print("FetchRequest failed with error: \(error.localizedDescription)")
             } catch {
                 fatalError()
             }

        let predicate = NSPredicate(format: "%K == %@", kModelNameAttributeName, modelName)
        fetchRequest.predicate = predicate
        
        var error:NSError? = nil
        do {
            let results = try context.executeFetchRequest(fetchRequest)
            if !results.isEmpty {
                return results[0].valueForKey(kRawDataAttributeName)!
            }
        } catch let error1 as NSError {
            error = error1
            if error != nil {
                print("Fetch data from CoreData failed with error:\(error!.localizedDescription)")
                return nil
            }
        }
        return nil
    }

    // MARK: - Core Data Saving support
    
    private func saveContext () {
        guard let context = self.privateManagedObjectContext where context.hasChanges else { return }
        
        do {
            try context.save()
        } catch let error as NSError {
            // Replace this implementation with code to handle the error appropriately.
            // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
            NSLog("Unresolved error \(error), \(error.userInfo)")
            abort()
        }
    }

