title: check for duplicates in Core data
body: <p>i found this code somewhere, can't really remember. How ever i can't get it to work properly. my Entity is named Hovedmenu
  .But i don't know what to put into the sortDescriptor no matter what i put in there it returns nil 0 objects.
  In my Hovedmenu i have attributes of menuPunkt numberRow date. In menuPunkt there should be data or is data of "Start"</p>
  
  <p>how do i get this code working ? i'm trying to use it against duplicates in my core data </p>
  
  <pre><code>-(void)checkForDuplicates
  {
  NSEntityDescription *entity = [NSEntityDescription entityForName:@"Hovedmenu"
                                        inManagedObjectContext:managedObjectContext];
  
  NSFetchRequest *request = [[NSFetchRequest alloc] init];
  [request setEntity:entity];
  
  NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"students"
                                                             ascending:NO];
  NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
  
  [request setSortDescriptors:sortDescriptors];
  [sortDescriptor release];
  
  NSError *Fetcherror;
  NSMutableArray *mutableFetchResults = [[managedObjectContext
                                      executeFetchRequest:request error:&amp;Fetcherror]     mutableCopy];
  
  if (!mutableFetchResults) {
  // error handling code.
  }
  
  if ([[mutableFetchResults valueForKey:@"users"]
   containsObject:name.text]) {
  //notify duplicates
  return;
   }
  else
  {
   //write your code to add data
  }
  }
  </code></pre>