/// <summary>
        /// Returns an HTMLElementDictionary containing references to all
        /// "a" tags in the current document where the element class is
        /// wlwStaticLink
        /// </summary>
        public HTMLElementDictionary getStaticLinksDictionary()
        {
            var output = new HTMLElementDictionary();

            foreach (IHTMLElement element in _anchorCollection)
            {
                if (element.className == AnchorClass.wlwStaticLink.ToString())
                {
                    output.Add(element.id, element);
                }
            }

            return output;
        }
        public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
        {
            AnchorData anchorData = new AnchorData();
            IHTMLElement selectedElement;
            IHTMLElement selectedAnchor;

            // This is passed by ref, and messes with our ability to
            // manipulate the editor contents. Zero it out until we're done:
            content = "";

            WLWEditorContent currentEditor = new WLWEditorContent(dialogOwner.Handle);

            _namedAnchorDictionary = currentEditor.getStaticAnchorsDictionary();
            _namedLinkDictionary = currentEditor.getStaticLinksDictionary();

            // Remember what was selected, in case the user cancels the operation:
            string _selectedText = "";
            string _selectedHtml = "";

            try
            {
                selectedElement = currentEditor.getSelectedElement();

                // Subsequent operations in this scope modify these values in the editor,
                // and we need to be able to reset them on cancel:
                _selectedText = selectedElement.innerText;
                _selectedHtml = selectedElement.outerHTML;

                // Processes within THIS call may modify contents of selectedElement.
                // This call must FOLLOW CAPTURE of innerText and outerHtml as above:
                selectedAnchor = currentEditor.getSelectedAnchor(selectedElement);

                anchorData.AnchorClass = AnchorClassSelector.selectByName(selectedAnchor.className);
                anchorData.AnchorID = selectedAnchor.id;
                anchorData.DisplayText = selectedAnchor.innerText;

                /*
                 * The ID of the anchor that is the target of a static link can be parsed
                 * from the link ID (composed of anchorID + Link Class Name and possibly
                 * an integer if more than one link to same anchor)
                 */
                anchorData.TargetAnchorID = this.getAnchorIDFromLinkID(anchorData.AnchorID);
            }
            catch (Exception)
            {
                MessageBox.Show("You cannot attach an anchor to this type of object");
                return DialogResult.Cancel;
            }

            // get string array of anchor names to pass to the Link Editor Form:
            string[] anchorNamesArray = new string[_namedAnchorDictionary.Count];
            _namedAnchorDictionary.Keys.CopyTo(anchorNamesArray, 0);

            using (var editContentForm = new EditContentForm(anchorData, anchorNamesArray))
            {
                if (editContentForm.ShowDialog() == DialogResult.OK)
                {
                    switch (anchorData.AnchorClass)
                    {
                        case AnchorClass.wlwStaticAnchor:

                            anchorData.AnchorID = this.getUniqueAnchorId(anchorData.AnchorID, selectedAnchor.id);
                            /*
                             * Capture the original and new AnchorID/href for updating links which refer to
                             * the current anchor (in case the AnchorID has been Modified):
                             */
                            string oldAnchorID = selectedAnchor.id;
                            string oldHref= "#" + oldAnchorID;
                            string newHref = anchorData.LinkHref;

                            // Set the new values . . .
                            selectedAnchor.id = anchorData.AnchorID;
                            selectedAnchor.innerText = anchorData.DisplayText;
                            selectedAnchor.className = anchorData.AnchorClass.ToString();

                            if (oldAnchorID != selectedAnchor.id)
                            {
                                // Update any links that refer to the old anchor id:
                                this.updateLinkReferences(oldHref, newHref);
                            }
                            break;

                        case AnchorClass.wlwStaticLink:
                            selectedAnchor.id = this.getUniqueLinkId(anchorData, selectedAnchor.id);
                            selectedAnchor.className = anchorData.AnchorClass.ToString();
                            selectedAnchor.innerText = anchorData.DisplayText;
                            IHTMLAnchorElement anchor = (IHTMLAnchorElement)selectedAnchor;
                            anchor.href = anchorData.LinkHref;
                            break;
                    }
                }
                else
                {
                    // Reset the contents of the originally selected element:
                    selectedElement.outerHTML = _selectedHtml;
                    return DialogResult.Cancel;
                }
            }

            // Make sure that the text contained within the anchor is selected in the editor:
            currentEditor.MoveSelectionToElementText(selectedAnchor);

            if (selectedAnchor.innerText != null)
            {
                /*
                 * ref variable content will replace whatever the current selection in the editor
                 * contains. Make sure the text that is replaced represents the inner text
                 * of the Anchor Element, or weird shit happens.
                 */
                content = selectedAnchor.innerText;
            }

            /*
             * These need to be nulled out, because they are not
             * re-initialized with successive uses of the plugin:
             */
            _namedAnchorDictionary = null;
            _namedLinkDictionary = null;

            return DialogResult.OK;
        }