public static void AddLabelActionsToChangeGroup(ChangeGroup changeGroup, ILabel label)
        {
            if (changeGroup != null && changeGroup.Actions.Count > 0 && label != null && label.LabelItems.Count > 0)
            {
                LabelProperties labelProperties = new LabelProperties(label);

                changeGroup.CreateAction(
                    WellKnownChangeActionId.Add,
                    null,
                    null,
                    // HACK: This is the ToPath which we shouldn't need for a label, but it is not currently nullable, so we use the first action Path
                    changeGroup.Actions[0].Path,
                    null,
                    null,
                    WellKnownContentType.VersionControlLabel.ReferenceName,
                    labelProperties.ToXmlDocument());

                // Create a MigrationAction for each item in the label
                foreach (ILabelItem labelItem in label.LabelItems)
                {
                    IMigrationAction action = changeGroup.CreateAction(
                        WellKnownChangeActionId.Add,
                        null,
                        null,
                        labelItem.ItemCanonicalPath,
                        labelItem.ItemVersion,
                        null,
                        labelItem.Recurse ?
                        WellKnownContentType.VersionControlRecursiveLabelItem.ReferenceName :
                        WellKnownContentType.VersionControlLabelItem.ReferenceName,
                        null);
                }
            }
        }
        public LabelFromMigrationAction(IMigrationAction labelMigrationAction)
        {
            LabelProperties labelProperties = new LabelProperties(FileMetadataProperties.CreateFromXmlDocument(labelMigrationAction.MigrationActionDescription));

            m_name       = labelProperties[LabelProperties.LabelNameKey];
            m_comment    = labelProperties[LabelProperties.LabelCommentKey];
            m_owner      = labelProperties[LabelProperties.LabelOwnerKey];
            m_scope      = labelProperties[LabelProperties.LabelScopeKey];
            m_labelItems = new List <ILabelItem>();
        }