title: How to Perform a Insert/Update With Core Data
body: <p>I've got the basics of inserting records and deleting records with Core Data; however, I'd appreciate help with one of the most common functions - the <strong>insert/update</strong>.</p>
  
  <p>Basically, I use <code>NSMutableArray</code> <code>arrayWithContentsOfURL</code> to get an array that contains rows from a <code>mysql</code> table.  What I need to do is now sync up my <code>CoreData</code> store.</p>
  
  <p>In other words, I need to add every row in the array to my <code>CoreData</code> table but if it already exists I need to update the record with the latest values.  Also if it exists in Core Data and not in the downloaded array, I'd need to delete it.</p>
  
  <p>I probably could hack this together; however, I'd like to see how its properly and efficiently done without memory leaks.</p>