//[Description("Occurs when the value of selected Anatomic Entity is changed")]
        //public event EventHandler ValueChanged
        //{
        //    // use pass through event subscription
        //    add { mainTree.NodeValueChanged += value; }
        //    remove { mainTree.NodeValueChanged -= value; }
        //}

        public void GetSelectedValues(AIMOntology outputDoc)
        {
            AnnotationDescriptionXML xmlAnnotationDescription = outputDoc.AnnotationDescriptionXML2.Exists ?
                                                                outputDoc.AnnotationDescriptionXML2.First : outputDoc.AnnotationDescriptionXML2.Append();

            anatomicEntityCollectionXMLType xmlAnatomicEntityCollection = xmlAnnotationDescription.anatomicEntityCollectionXML.Exists ?
                                                                          xmlAnnotationDescription.anatomicEntityCollectionXML.First : xmlAnnotationDescription.anatomicEntityCollectionXML.Append();

            foreach (DropDownTreeNode node in mainTree.Nodes)
            {
                if (node != null)
                {
                    ComboItem comboItem = node.ComboBox.SelectedItem as ComboItem;
                    if (comboItem != null && comboItem.TagValue != null)
                    {
                        AnatomicEntityXML oldXmlAnatomicEntity = comboItem.TagValue as AnatomicEntityXML;
                        if (oldXmlAnatomicEntity != null)
                        {
                            AnatomicEntityXML xmlAnatomicEntity                     = xmlAnatomicEntityCollection.AnatomicEntityXML2.Append();
                            xmlAnatomicEntity.codeValue.Append().Value              = oldXmlAnatomicEntity.codeValue.Exists ? oldXmlAnatomicEntity.codeValue.First.Value : string.Empty;
                            xmlAnatomicEntity.codeMeaning.Append().Value            = oldXmlAnatomicEntity.codeMeaning.Exists ? oldXmlAnatomicEntity.codeMeaning.First.Value : string.Empty;
                            xmlAnatomicEntity.codingSchemeDesignator.Append().Value = oldXmlAnatomicEntity.codingSchemeDesignator.Exists ? oldXmlAnatomicEntity.codingSchemeDesignator.First.Value : string.Empty;
                            xmlAnatomicEntity.relationship.Append().Value           = oldXmlAnatomicEntity.relationship.Exists ? oldXmlAnatomicEntity.relationship.First.Value : string.Empty;

                            // Check node's descendents
                            if (node.Nodes.Count > 0)
                            {
                                DropDownTreeNode childNode = node.Nodes[0] as DropDownTreeNode;
                                this.ReadChildTreeNode(childNode, xmlAnatomicEntity);
                            }
                        }
                    }
                }
            }
        }
        public void GetSelectedValues(AIMOntology outputDoc)
        {
            AnnotationDescriptionXML xmlAnnotationDescription = outputDoc.AnnotationDescriptionXML2.Exists ?
                                                                outputDoc.AnnotationDescriptionXML2.First : outputDoc.AnnotationDescriptionXML2.Append();

            // Imaging Observation Collection
            imagingObservationCollectionXMLType xmlImagingObsCollection = xmlAnnotationDescription.imagingObservationCollectionXML.Exists ?
                                                                          xmlAnnotationDescription.imagingObservationCollectionXML.First : xmlAnnotationDescription.imagingObservationCollectionXML.Append();

            foreach (ObservationSelection selectedValues in _selectedImagingObservations)
            {
                if (selectedValues.xmlImagingObservation.Node != null)
                {
                    // Imaging Observation
                    ImagingObservationXML xmlImagingObservation                 = xmlImagingObsCollection.ImagingObservationXML2.Append();
                    xmlImagingObservation.codeValue.Append().Value              = selectedValues.xmlImagingObservation.codeValue.Exists ? selectedValues.xmlImagingObservation.codeValue.First.Value : string.Empty;
                    xmlImagingObservation.codeMeaning.Append().Value            = selectedValues.xmlImagingObservation.codeMeaning.Exists ? selectedValues.xmlImagingObservation.codeMeaning.First.Value : string.Empty;
                    xmlImagingObservation.codingSchemeDesignator.Append().Value = selectedValues.xmlImagingObservation.codingSchemeDesignator.Exists ? selectedValues.xmlImagingObservation.codingSchemeDesignator.First.Value : string.Empty;
                    xmlImagingObservation.comment.Append().Value                = string.Empty; // no value for now

                    // Imaging Observation Characteristic Collection
                    imagingObservationCharacteristicCollectionXMLType xmlImgObsCharCollection = xmlImagingObservation.imagingObservationCharacteristicCollectionXML.Append();
                    if (selectedValues.xmlImagingObservation.imagingObservationCharacteristicCollectionXML.Exists)
                    {
                        imagingObservationCharacteristicCollectionXMLType oldXmlImagingObsCharCollection = selectedValues.xmlImagingObservation.imagingObservationCharacteristicCollectionXML.First;
                        foreach (int selectedImgObsCharIndex in selectedValues.selectionIndecies)
                        {
                            // Check whether the selected imaging observation existed in the old (source) collection
                            if (selectedImgObsCharIndex > -1 && selectedImgObsCharIndex < oldXmlImagingObsCharCollection.ImagingObservationCharacteristicXML2.Count)
                            {
                                // Imaging Observation Characteristic
                                ImagingObservationCharacteristicXML oldXmlImagingObsChar = oldXmlImagingObsCharCollection.ImagingObservationCharacteristicXML2[selectedImgObsCharIndex];
                                ImagingObservationCharacteristicXML xmlImagingObsChar    = xmlImgObsCharCollection.ImagingObservationCharacteristicXML2.Append();
                                xmlImagingObsChar.codeValue.Append().Value              = oldXmlImagingObsChar.codeValue.Exists ? oldXmlImagingObsChar.codeValue.First.Value : string.Empty;
                                xmlImagingObsChar.codeMeaning.Append().Value            = oldXmlImagingObsChar.codeMeaning.Exists ? oldXmlImagingObsChar.codeMeaning.First.Value : string.Empty;
                                xmlImagingObsChar.codingSchemeDesignator.Append().Value = oldXmlImagingObsChar.codingSchemeDesignator.Exists ? oldXmlImagingObsChar.codingSchemeDesignator.First.Value : string.Empty;
                                xmlImagingObsChar.comment.Append().Value = string.Empty; // no value for now
                            }
                        }
                    }
                }
            }
        }