- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
   if (__ persistentStoreCoordinator != nil) {
      return __persistentStoreCoordinator;
   }

   NSURL *storeURL = [[self applicationDocumentsDirectory]
      URLByAppendingPathComponent:@"PocketTasks.sqlite"];
   NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
      [NSNumber numberWithBool:YES],
      NSMigratePersistentStoresAutomaticallyOption,
      [NSNumber numberWithBool:YES],
      NSInferMappingModelAutomaticallyOption, nil];

   NSError *error = nil;
   __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] 
      initWithManagedObjectModel:[self managedObjectModel]];

   if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType 
      configuration:nil 
                URL:storeURL 
            options:options 
              error:&error]) 
   {
      NSLog(@"Wystąpił błąd %@, %@", error, [error userInfo]);
      abort();
   }
   return __persistentStoreCoordinator;
}
