protected override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            switch (this.ParameterSetName)
            {
            case JoinContentParameterSet:
                _repository.Associate(Entity, Id, ToEntity, ToId, Attribute);
                break;

            case JoinContentByInputObjectParameterSet:
                _repository.Associate(InputObject.LogicalName, InputObject.Id, ToEntity, ToId, Attribute);
                break;

            default:
                break;
            }
        }
        public static void LinkPrincipalRoles(ContentRepository repository, string entity, Guid id, string entity2, Guid[] related)
        {
            string relationshipName = "systemuserroles_association";

            if (entity.Equals("team", StringComparison.InvariantCultureIgnoreCase) || entity2.Equals("team", StringComparison.InvariantCultureIgnoreCase))
            {
                relationshipName = "teamroles_association";
            }

            repository.Associate(entity, id, new Relationship(relationshipName),
                                 new EntityReferenceCollection(
                                     related.Select <Guid, EntityReference>(
                                         g => new EntityReference(entity2, g)
                                         ).ToList()
                                     )
                                 );
        }