private void saveAge()
        {
            if (m_theWorkspace == null)
            {
                MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (txtMapUnitAbbreviation.Text == "")
            {
                MessageBox.Show("Please select a valid map unit!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /// ---------------------------------------------------------------------------------------------------------
            /// <start> Settings to save geologic events changes --------------------------------------------------------
            /// Connect with the Geologic Events table
            GeologicEventsAccess geoEvtsAccess = new GeologicEventsAccess(m_theWorkspace);
            geoEvtsAccess.AddGeologicEvents();

            Dictionary<string, GeologicEventsAccess.GeologicEvents> deleteGeologicEventsDictionary = new Dictionary<string, GeologicEventsAccess.GeologicEvents>();
            foreach (KeyValuePair<string, GeologicEventsAccess.GeologicEvents> anOldGeologicEventsEntry in geoEvtsAccess.GeologicEventsDictionary)
            {
                /// Identify if the old record still exits in the new dictionary
                /// If not, delete this record
                if (!m_GeologicEventsDictionary.ContainsKey(anOldGeologicEventsEntry.Key))
                { deleteGeologicEventsDictionary.Add(anOldGeologicEventsEntry.Key, anOldGeologicEventsEntry.Value); }
            }
            foreach (KeyValuePair<string, GeologicEventsAccess.GeologicEvents> anDeleteGeologicEventsEntry in deleteGeologicEventsDictionary)
            {
                GeologicEventsAccess.GeologicEvents thisGeoEvt = anDeleteGeologicEventsEntry.Value;
                /// Remove item from the evet list for this map unit
                if (liEvts4ThisUnit.Items.Contains(thisGeoEvt.AgeDisplay))
                {
                    liEvts4ThisUnit.Items.Remove(thisGeoEvt.AgeDisplay);
                    string thisGeoEvtID = m_EvtListDictionary[thisGeoEvt.AgeDisplay];

                    foreach (KeyValuePair<string, ExtendedAttributesAccess.ExtendedAttributes> anExtAttrEntry in m_ExtendedAttributesDictionary)
                    {
                        ExtendedAttributesAccess.ExtendedAttributes thisExtAttr = anExtAttrEntry.Value;
                        if (thisExtAttr.ValueLinkID == thisGeoEvtID)
                        {
                            string thisID = anExtAttrEntry.Key;
                            m_ExtendedAttributesDictionary.Remove(thisID);
                        }
                    }
                }
                geoEvtsAccess.DeleteGeologicEvents(thisGeoEvt);
            }

            geoEvtsAccess.GeologicEventsDictionary = m_GeologicEventsDictionary;

            geoEvtsAccess.SaveGeologicEvents();

            /// Reset variable m_GeologicEventsDictionary and m_EvtListDictionary
            geoEvtsAccess = new GeologicEventsAccess(m_theWorkspace);
            geoEvtsAccess.AddGeologicEvents();
            m_GeologicEventsDictionary = geoEvtsAccess.GeologicEventsDictionary;
            m_EvtListDictionary.Clear();

            foreach (KeyValuePair<string, GeologicEventsAccess.GeologicEvents> aGeologicEventsEntry in geoEvtsAccess.GeologicEventsDictionary)
            {
                m_EvtListDictionary.Add(aGeologicEventsEntry.Value.AgeDisplay, aGeologicEventsEntry.Key);
            }

            /// <end> ---------------------------------------------------------------------------------------------------
            /// ---------------------------------------------------------------------------------------------------------

            /// ---------------------------------------------------------------------------------------------------------
            /// <start> Settings to save extended attributes changes ----------------------------------------------------
            /// connect with the Extended Attributes table
            ExtendedAttributesAccess extAttrAccess = new ExtendedAttributesAccess(m_theWorkspace);
            /// Search for the related record in the extended attribute table with the old map unit value
            extAttrAccess.AddExtendedAttributes(("OwnerID = '" + m_initMapUnit + "'"));

            Dictionary<string, ExtendedAttributesAccess.ExtendedAttributes> deleteExtendedAttributesDictionary = new Dictionary<string, ExtendedAttributesAccess.ExtendedAttributes>();
            foreach (KeyValuePair<string, ExtendedAttributesAccess.ExtendedAttributes> anOldExtendedAttributesEntry in extAttrAccess.ExtendedAttributesDictionary)
            {
                /// Identify if the old record still exits in the new dictionary
                /// If not, delete this record
                if (!m_ExtendedAttributesDictionary.ContainsKey(anOldExtendedAttributesEntry.Key))
                { deleteExtendedAttributesDictionary.Add(anOldExtendedAttributesEntry.Key, anOldExtendedAttributesEntry.Value); }
            }

            foreach (KeyValuePair<string, ExtendedAttributesAccess.ExtendedAttributes> anDeleteExtendedAttributesEntry in deleteExtendedAttributesDictionary)
            {
                ExtendedAttributesAccess.ExtendedAttributes thisExtAttr = anDeleteExtendedAttributesEntry.Value;
                extAttrAccess.DeleteExtendedAttributes(thisExtAttr);
            }

            extAttrAccess.ExtendedAttributesDictionary = m_ExtendedAttributesDictionary;

            extAttrAccess.SaveExtendedAttributes();
            /// <end> ---------------------------------------------------------------------------------------------------
            /// ---------------------------------------------------------------------------------------------------------

            initEmptyAgeEventTab();
        }
        private void deleteExtendedAtrributesRecord(string mapUnit)
        {
            if (m_theWorkspace == null)
            {
                MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /// Connect with the Extended Attribute table
            ExtendedAttributesAccess extAttrAccess = new ExtendedAttributesAccess(m_theWorkspace);
            /// Search for the extended attributes record for this map unit
            extAttrAccess.AddExtendedAttributes("OwnerID = '" + mapUnit + "'");

            if (extAttrAccess.ExtendedAttributesDictionary.Count != 0)
            {
                ExtendedAttributesAccess.ExtendedAttributes anExtendedAttributes = extAttrAccess.ExtendedAttributesDictionary.First().Value;
                extAttrAccess.DeleteExtendedAttributes(anExtendedAttributes);
            }
        }
        /// <summary>
        /// Set values for the age event tabs
        /// The values are from Extended Attributes table and Geologic Events table
        /// </summary>
        private void initAgeEventTab(string mapUnit)
        {
            m_initMapUnit = mapUnit;

            if (m_theWorkspace == null)
            {
                MessageBox.Show("Please open a working space!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /// Connect with the Extended Attribute table
            ExtendedAttributesAccess extAttrAccess = new ExtendedAttributesAccess(m_theWorkspace);
            /// Search the extended attributes records for this map unit
            extAttrAccess.AddExtendedAttributes("OwnerID = '" + mapUnit + "'");
            m_ExtendedAttributesDictionary = extAttrAccess.ExtendedAttributesDictionary;
            foreach (KeyValuePair<string, ExtendedAttributesAccess.ExtendedAttributes> anExtendedAttributeEntry in extAttrAccess.ExtendedAttributesDictionary)
            {
                ExtendedAttributesAccess.ExtendedAttributes thisExtendedAttribute = anExtendedAttributeEntry.Value;

                string vLinkId = thisExtendedAttribute.ValueLinkID;
                if (vLinkId != null)
                {
                    /// Connect with Geologic Events table
                    GeologicEventsAccess geoEvtsAccess = new GeologicEventsAccess(m_theWorkspace);
                    geoEvtsAccess.AddGeologicEvents("GeologicEvents_ID = '" + vLinkId + "'");

                    if (geoEvtsAccess.GeologicEventsDictionary.Count != 0)
                    {
                        GeologicEventsAccess.GeologicEvents thisGeologicEvent = geoEvtsAccess.GeologicEventsDictionary.First().Value;
                        liEvts4ThisUnit.Items.Add(thisGeologicEvent.AgeDisplay);
                    }
                }
            }
        }