I have 2 entities: Series and Season. A Series can have multiple seasons, so I set the relationship type to "to many". season\_counter is an Int Array, containing the amount of episodes.

```
let newSeries = NSEntityDescription.insertNewObjectForEntityForName("Series", inManagedObjectContext: self.context!) as! Series

for var i = 0; i < season_counter.count; ++i{
         let newSeason = NSEntityDescription.insertNewObjectForEntityForName("Season", inManagedObjectContext: self.context!) as! Season
         newSeason.value = i+1
         newSeason.episodes = season_counter[i]
         newSeries.setValue(NSSet(object: newSeason), forKey: "seasons")

     do {
         try context?.save()
    } catch _ {
    }
}

```

While debugging I noticed, that season\_counter stores the correct values. When I display the results, I have only the last season stored (for example 13 episodes, seasons.count is 1):

```
do {
    let fetchRequest = NSFetchRequest(entityName: "Season")
    fetchRequest.predicate = NSPredicate(format: "series = %@", series)
    try seasons = context?.executeFetchRequest(fetchRequest) as! [Season]

    print(seasons.count)
    print(seasons[0].episodes)
} catch {
}

```

Any tips to solve this?