title: How to not save again the already saved data in Core Data?
body: <p>I am able to save and retrieve data from Core Data, but I don't know how to not duplicate or avoid the same saved data in Core Data. How should I do this? Any help would be really thankful.</p>
  
  <p>Saving data:</p>
  
  <pre><code>let historyData = trackHistoryData()
  historyData.HistorygetConsignmentNo = self.getTrackno
  print("cnno",historyData.HistorygetConsignmentNo)
  historyData.HistorydateStr = jsonArray[0]["date"] as! String
  print("date",historyData.HistorydateStr)
  historyData.HistoryofficeStr = jsonArray[0]["office"] as! String
  print("office",historyData.HistoryofficeStr)
  historyData.HistoryprocessStr = jsonArray[0]["process"] as! String
  print("process", historyData.HistoryprocessStr)
  
  let history = HistoryTrack(context: persistenceService.context)
  
  history.cnNo = historyData.HistorygetConsignmentNo
  history.date = historyData.HistorydateStr
  history.office = historyData.HistoryofficeStr
  history.process = historyData.HistoryprocessStr
  persistenceService.saveContext()
  </code></pre>
  
  <p>Retrieving Data:</p>
  
  <pre><code>let fetchRequest:NSFetchRequest&lt;HistoryTrack&gt; = HistoryTrack.fetchRequest()
  
  do {
      let historytrack = try persistenceService.context.fetch(fetchRequest)
      self.trackhistoryData = historytrack
      self.trackHistoryTblView.reloadData()
  } catch {}
  </code></pre>