public static SelfServiceCategory GetFromContent(IPublishedContent content, SelfServiceCategory parent = null) {
     return content == null ? null : new SelfServiceCategory(content, parent);
 }
 protected SelfServiceCategory(IPublishedContent content, SelfServiceCategory parent = null) {
     Content = content;
     Parent = parent;
 }
 private void AppendCategory(List<int> categoryIds, SelfServiceCategory category) {
     categoryIds.Add(category.Id);
     foreach (SelfServiceCategory child in category.Children) {
         AppendCategory(categoryIds, child);
     }
 }
        /// <summary>
        /// Method used for parsing an instance if <code>IPublishedContent</code> into an instance of <code>SelfServiceCategory</code>.
        /// </summary>
        /// <param name="content">The instance of <code>IPublishedContent</code> representing the category.</param>
        /// <param name="parent">The parent category, or <code>null</code> if no parent category.</param>
        /// <returns>Returns an instance of <code>SelfServiceCategory</code> representing the catrgory.</returns>
        public SelfServiceCategory ParseCategory(IPublishedContent content, SelfServiceCategory parent) {

            // If "content" is NULL, we don't bother doing any further parsing
            if (content == null) return null;

            // Iterate through the added plugins
            foreach (SelfServicePluginBase plugin in Context.Plugins) {

                // Let the plugin parse the category (NULL means the plugin didn't handle or parse the category)
                SelfServiceCategory category = plugin.ParseCategory(content, parent);
                if (category != null) return category;

            }

            // Fallback if no plugins did handle or parse the category
            return SelfServiceCategory.GetFromContent(content, parent);

        }
 /// <summary>
 /// Parses the specified <code>content</code> into an instance of <code>SelfServiceCategory</code>.
 /// </summary>
 /// <param name="content">An instance of <code>IPublishedContent</code> representing the category.</param>
 /// <param name="parent">The parent category.</param>
 /// <returns>Returns an instance of <code>SelfServiceCategory</code>.</returns>
 public virtual SelfServiceCategory ParseCategory(IPublishedContent content, SelfServiceCategory parent) {
     return null;
 }