private void AddPersonRelationship(int personId, int personRelatedToId, int relationshipId, Person familyMemberToUpdate)
        {
            var found = false;
            foreach (var rel in familyMemberToUpdate.PersonRelationships.Where(rel => rel.PersonRelatedToId == personRelatedToId))
            {
                if (rel.RelationshipId != relationshipId)
                {
                    rel.RelationshipId = relationshipId;
                    rel.Changed = DateTime.Now;
                }
                found = true;
                break;
            }

            if (found) return;
            //Create a new one
            var newRelationship = new PersonRelationship();
            newRelationship.PersonRelatedToId = personRelatedToId;
            newRelationship.RelationshipId = relationshipId;
            newRelationship.PersonId = personId;
            newRelationship.Created = DateTime.Now;
            newRelationship.Changed = DateTime.Now;
            Context.AddToPersonRelationships(newRelationship);
        }
 /// <summary>
 /// Create a new PersonRelationship object.
 /// </summary>
 /// <param name="personRelationshipId">Initial value of the PersonRelationshipId property.</param>
 /// <param name="personRelatedToId">Initial value of the PersonRelatedToId property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 /// <param name="relationshipId">Initial value of the RelationshipId property.</param>
 /// <param name="created">Initial value of the Created property.</param>
 /// <param name="changed">Initial value of the Changed property.</param>
 public static PersonRelationship CreatePersonRelationship(global::System.Int32 personRelationshipId, global::System.Int32 personRelatedToId, global::System.Int32 personId, global::System.Int32 relationshipId, global::System.DateTime created, global::System.DateTime changed)
 {
     PersonRelationship personRelationship = new PersonRelationship();
     personRelationship.PersonRelationshipId = personRelationshipId;
     personRelationship.PersonRelatedToId = personRelatedToId;
     personRelationship.PersonId = personId;
     personRelationship.RelationshipId = relationshipId;
     personRelationship.Created = created;
     personRelationship.Changed = changed;
     return personRelationship;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PersonRelationships EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPersonRelationships(PersonRelationship personRelationship)
 {
     base.AddObject("PersonRelationships", personRelationship);
 }