title: Context does not save the changes with error 1550
body: <p>I'm trying to update an entity and save the changes. I'm getting always the following error:</p>
  
  <pre><code>The operation couldn’t be completed. (Cocoa error 1550.)
  </code></pre>
  
  <p><strong>Method:</strong></p>
  
  <pre><code>- (BOOL) updateEvent:(EventDTO*)eventDTO{
      BOOL saved = YES;
  
      [self getDataCoreContext];
  
      if (context) {
          NSError *error;
  
          Event *myEvent = (Event *)[context existingObjectWithID:eventDTO.entitysID error:&amp;error];
  
          myEvent.name = eventDTO.name;
          myEvent.descrptn = eventDTO.description;
          myEvent.date = eventDTO.date;
          myEvent.locLatitude = [eventDTO getLatidude];
          myEvent.locLongitude = [eventDTO getLongitude];
          myEvent.numberOfInvited= [NSNumber numberWithInteger:[eventDTO.invitedMembers count]];
  
          for (User *invUser in eventDTO.invitedMembers) {
              [myEvent addInvitedUsersObject:invUser];
          }
  
          for (User *accUser in eventDTO.acceptedMembers) {
              [myEvent addAcceptedUsersObject:accUser];
          }
  
          myEvent.createdBy = (User*)[context existingObjectWithID:eventDTO.creator.objectID error:&amp;error];
  
          if (![context save:&amp;error]) {
              NSLog(@"Whoops, couldn't save: %@", [error localizedDescription]);
              saved = NO;
          }
      }
      return saved;
  }
  </code></pre>
  
  <p>Its confusing me really, because i m not getting it what the problem is.. I have also tried to fetch the object and modify it. But same error. </p>
  
  <p>Any explanation or hints would be great.</p>
  
  <p><strong>EDIT (Complete Error Object) 1:</strong></p>
  
  <pre><code>ERROR: Error Domain=NSCocoaErrorDomain Code=1550 "The operation couldn’t be completed. (Cocoa error 1550.)" UserInfo=0x14a00130 {NSValidationErrorObject=&lt;Event: 0x11024aa0&gt; (entity: Event; id: 0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt; ; data: {
      acceptedUsers =     (
      );
      createdBy = "0x11024ae0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p1&gt;";
      date = "2013-05-11 16:15:09 +0000";
      descrptn = Auauuauau;
      invitedUsers =     (
          "0x11069cd0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p3&gt;",
          "0x1104da60 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p6&gt;",
          "0x1104da40 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p4&gt;",
          "0x110687a0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p2&gt;",
          "0x1104da50 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p5&gt;"
      );
      locLatitude = "51.45373916625977";
      locLongitude = "7.264190196990967";
      name = lALLALLa;
      numberOfInvited = 5;
  }), NSValidationErrorKey=invitedUsers, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1550.), NSValidationErrorValue=Relationship 'invitedUsers' on managed object (0x11024aa0) &lt;Event: 0x11024aa0&gt; (entity: Event; id: 0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt; ; data: {
      acceptedUsers =     (
      );
      createdBy = "0x11024ae0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p1&gt;";
      date = "2013-05-11 16:15:09 +0000";
      descrptn = Auauuauau;
      invitedUsers =     (
          "0x11069cd0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p3&gt;",
          "0x1104da60 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p6&gt;",
          "0x1104da40 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p4&gt;",
          "0x110687a0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p2&gt;",
          "0x1104da50 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p5&gt;"
      );
      locLatitude = "51.45373916625977";
      locLongitude = "7.264190196990967";
      name = lALLALLa;
      numberOfInvited = 5;
  }) with objects {(
      &lt;User: 0x110accb0&gt; (entity: User; id: 0x11069cd0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p3&gt; ; data: {
      acceptedEvents = "&lt;relationship fault: 0x97084a0 'acceptedEvents'&gt;";
      createdEvents = "&lt;relationship fault: 0x97017b0 'createdEvents'&gt;";
      deviceInfo = nil;
      displayName = "Daniel Higgins";
      invitedToEvents =     (
          "0x110abbb0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x110abba0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p5&gt;"
      );
      memberShipDetails = nil;
      phoneNumber = "555-478-7672";
      realName = "Daniel Higgins";
      status = "WAZZUUP?!";
      userID = nil;
  }),
      &lt;User: 0x110d0e10&gt; (entity: User; id: 0x1104da60 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p6&gt; ; data: {
      acceptedEvents = "&lt;relationship fault: 0x14aa0850 'acceptedEvents'&gt;";
      createdEvents = "&lt;relationship fault: 0x13c0f290 'createdEvents'&gt;";
      deviceInfo = nil;
      displayName = "Hank Zakroff";
      invitedToEvents =     (
          "0x110abbb0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x110abba0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p5&gt;"
      );
      memberShipDetails = nil;
      phoneNumber = "(555) 766-4823";
      realName = "Hank Zakroff";
      status = "WAZZUUP?!";
      userID = nil;
  }),
      &lt;User: 0x110ad1a0&gt; (entity: User; id: 0x1104da40 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p4&gt; ; data: {
      acceptedEvents = "&lt;relationship fault: 0x16632850 'acceptedEvents'&gt;";
      createdEvents = "&lt;relationship fault: 0x16632890 'createdEvents'&gt;";
      deviceInfo = nil;
      displayName = "John Appleseed";
      invitedToEvents =     (
          "0x110abbb0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x110abba0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p5&gt;"
      );
      memberShipDetails = nil;
      phoneNumber = "888-555-5512";
      realName = "John Appleseed";
      status = "WAZZUUP?!";
      userID = nil;
  }),
      &lt;User: 0x110b3220&gt; (entity: User; id: 0x110687a0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p2&gt; ; data: {
      acceptedEvents = "&lt;relationship fault: 0x110f50f0 'acceptedEvents'&gt;";
      createdEvents = "&lt;relationship fault: 0x16628a60 'createdEvents'&gt;";
      deviceInfo = nil;
      displayName = "Kate Bell";
      invitedToEvents =     (
          "0x110abbb0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x110abba0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p5&gt;"
      );
      memberShipDetails = nil;
      phoneNumber = "(555) 564-8583";
      realName = "Kate Bell";
      status = "WAZZUUP?!";
      userID = nil;
  }),
      &lt;User: 0x110ace30&gt; (entity: User; id: 0x1104da50 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/User/p5&gt; ; data: {
      acceptedEvents = "&lt;relationship fault: 0x1a4c6350 'acceptedEvents'&gt;";
      createdEvents = "&lt;relationship fault: 0x1a4c6390 'createdEvents'&gt;";
      deviceInfo = nil;
      displayName = "Anna Haro";
      invitedToEvents =     (
          "0x110abbb0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x166c0840 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p8&gt;",
          "0x110abba0 &lt;x-coredata://9F88714B-84EC-4E8F-9BC4-78E365A8FE0A/Event/p5&gt;"
      );
      memberShipDetails = nil;
      phoneNumber = "555-522-8243";
      realName = "Anna Haro";
      status = "WAZZUUP?!";
      userID = nil;
  })
  )}}
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>According to the nice explanation of @Sulthan i found the Problem.</p>
  
  <p>In my for loops i had to check if this User already exist in that Event:</p>
  
  <pre><code>for (User *invUser in eventDTO.invitedMembers) {
      BOOL existsInInvitedList = [[eventDTO.invitedMembers valueForKeyPath:@"objectID"] containsObject:invUser.objectID];
      if (!existsInInvitedList) {
          [myEvent addInvitedUsersObject:invUser];
      }
  }
  
  
  for (User *accUser in eventDTO.acceptedMembers) {
      BOOL existsInAcceptedList = [[eventDTO.acceptedMembers valueForKeyPath:@"objectID"] containsObject:accUser.objectID];
      if (!existsInAcceptedList) {
          [myEvent addAcceptedUsersObject:accUser];
      }
  }
  </code></pre>
  
  <p>So there were no duplicates in there.. </p>