private XmlVerifiedCategory GetVerifiedCategory(
            [NotNull] DataQualityCategory category)
        {
            string key = Assert.NotNull(category.Uuid);

            XmlVerifiedCategory xmlCategory;

            if (!_categoriesByUuid.TryGetValue(key, out xmlCategory))
            {
                xmlCategory = new XmlVerifiedCategory(category.Name,
                                                      category.Abbreviation,
                                                      category.Uuid,
                                                      category.Description,
                                                      category.ListOrder);

                _categoriesByUuid.Add(key, xmlCategory);

                if (category.ParentCategory == null)
                {
                    _rootCategories.Add(xmlCategory);
                }
                else
                {
                    // ensure that parent category is added also
                    XmlVerifiedCategory parentVerifiedCategory =
                        GetVerifiedCategory(category.ParentCategory);

                    parentVerifiedCategory.AddSubCategory(xmlCategory);
                }

                _sortOrderDirty = true;
            }

            return(xmlCategory);
        }
        private void AddToCategory(
            [NotNull] XmlVerifiedQualityCondition xmlVerifiedCondition,
            [NotNull] DataQualityCategory category)
        {
            XmlVerifiedCategory xmlCategory = GetVerifiedCategory(category);

            xmlCategory.AddCondition(xmlVerifiedCondition);
        }
        private void AddToUndefinedCategory(
            [NotNull] XmlVerifiedQualityCondition xmlVerifiedCondition)
        {
            string key = string.Empty;

            XmlVerifiedCategory xmlCategory;

            if (!_categoriesByUuid.TryGetValue(key, out xmlCategory))
            {
                xmlCategory = new XmlVerifiedCategory("<no category>");

                _categoriesByUuid.Add(key, xmlCategory);
                _rootCategories.Add(xmlCategory);

                _sortOrderDirty = true;
            }

            xmlCategory.AddCondition(xmlVerifiedCondition);
        }