/// <summary>
        /// Allocate the condition an ID, and add it
        /// </summary>
        /// <param name="condition"></param>
        public void add(condition condition, string suggestedId)
        {
            //Dictionary<string, string> conditionsById = new Dictionary<string, string>();
            //foreach (condition xx in conditions.condition)
            //{
            //    conditionsById.Add(xx.id, "");
            //}

            //condition.id = IdGenerator.generateIdForXPath(conditionsById, null, null, suggestedId);
            condition.id = IdHelper.GenerateShortID(5);

            conditions.condition.Add(condition);

            save();

            log.Debug("Condition written!");
        }
        /// <summary>
        /// Add the XPath to the XPaths part.  As a side effect, set fields tag
        /// and xpathid
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cxpId">storeItemID for data binding</param>
        /// <param name="strXPath"></param>
        /// <param name="prefixMappings"></param>
        public xpathsXpath setup(string idTypeSuffix, string cxpId, string strXPath,
                                 string prefixMappings,
                                 bool setupQuestionNow)
        {
            xpathsXpath result = null;

            // If the XPath is already defined in our XPaths part, don't do it again.
            // Also need this for ID generation.
            Dictionary <string, string> xpathsById = new Dictionary <string, string>();

            foreach (xpathsXpath xx in xpaths.xpath)
            {
                try
                {
                    xpathsById.Add(xx.id, "");
                }
                catch (Exception e)
                {
                    log.Error(xx.id + " exists already!"); // How did this happen??
                    throw e;
                }
                if (xx.dataBinding.xpath.Equals(strXPath) &&
                    xx.dataBinding.storeItemID.Equals(cxpId))
                {
                    result  = xx;
                    xpathId = xx.id;
                    log.Info("This XPath is already setup, with ID: " + xpathId);
                    break;
                }
            }

            if (result == null) // not already defined
            {
                //xpathId = IdGenerator.generateIdForXPath(xpathsById, "", idTypeSuffix, strXPath);
                xpathId = IdHelper.GenerateShortID(5);

                // Question
                string questionID = null;
                if (setupQuestionNow &&
                    model.questionsPart != null)
                {
                    throw new NotImplementedException();
                    //FormQuestion formQuestion = new FormQuestion(model.questionsPart,
                    //    strXPath, xpathId);
                    //formQuestion.ShowDialog();
                    //// TODO - handle cancel

                    //formQuestion.updateQuestionsPart(formQuestion.getQuestion());

                    //questionID = formQuestion.textBoxQID.Text;
                    //formQuestion.Dispose();
                }

                // Also add to XPaths
                result = createXpath(
                    strXPath,
                    xpathId,
                    cxpId, prefixMappings, questionID);
            }

            return(result);
        }