/// <summary>
        /// Handles the saved event of the Single Concept matching control.
        /// Adds the encoded term to the encoded list box.
        /// </summary>
        /// <param name="sender">The single concept matching control.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SingleConceptMatching_Saved(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.connected && this.SingleConceptMatching.InputBoxSelectedItem != null)
            {
                ObservableCollection <AdditionalTextBoxResult> additionalTextBoxResults = new ObservableCollection <AdditionalTextBoxResult>();

                foreach (object o in this.SingleConceptMatching.AdditionalTextBoxSelectedTerms)
                {
                    AdditionalTextBoxResult additionalTextBoxResult = o as AdditionalTextBoxResult;

                    if (additionalTextBoxResult != null)
                    {
                        additionalTextBoxResults.Add(additionalTextBoxResult);
                    }
                }

                this.ShowProgressBar();

                TerminologyManager.EncodeConcept(this.SingleConceptMatching.InputBoxSelectedItem as InputFieldResult, additionalTextBoxResults);
            }
            else
            {
                this.EncodeOutput(CreateUnencodedConcept(this.SingleConceptMatching.InputBoxText));

                this.SingleConceptMatching.Clear();
                this.SingleConceptMatching.FocusInputBox();
            }

            this.lastInputBoxResults          = null;
            this.lastInputBoxSearch           = string.Empty;
            this.lastAdditionalTextBoxSearch  = string.Empty;
            this.lastAdditionalTextBoxResults = null;
        }
        /// <summary>
        /// Checks to see if a qualifier result was in the previous results.
        /// </summary>
        /// <param name="result">The result to check.</param>
        /// <returns>Either the old or new result.</returns>
        private AdditionalTextBoxResult GetMatchingAdditionalTextBoxResultsFromLastResults(AdditionalTextBoxResult result)
        {
            if (this.lastAdditionalTextBoxResults != null)
            {
                foreach (AdditionalTextBoxResult lastResult in this.lastAdditionalTextBoxResults.AdditionalTextBoxResults)
                {
                    if (lastResult.SelectedItem.SnomedConceptId == result.SelectedItem.SnomedConceptId && lastResult.StartIndex == result.StartIndex && lastResult.Length == result.Length)
                    {
                        return lastResult;
                    }
                }
            }

            return result;
        }
        /// <summary>
        /// Checks to see if a qualifier result was in the previous results.
        /// </summary>
        /// <param name="result">The result to check.</param>
        /// <returns>Either the old or new result.</returns>
        private AdditionalTextBoxResult GetMatchingAdditionalTextBoxResultsFromLastResults(AdditionalTextBoxResult result)
        {
            if (this.lastAdditionalTextBoxResults != null)
            {
                foreach (AdditionalTextBoxResult lastResult in this.lastAdditionalTextBoxResults.AdditionalTextBoxResults)
                {
                    if (lastResult.SelectedItem.SnomedConceptId == result.SelectedItem.SnomedConceptId && lastResult.StartIndex == result.StartIndex && lastResult.Length == result.Length)
                    {
                        return(lastResult);
                    }
                }
            }

            return(result);
        }