/// <summary>
        /// Creates property items for all properties in the specified object.
        /// </summary>
        /// <param name="instance">The object instance.</param>
        /// <param name="options">The options.</param>
        /// <returns>Enumeration of PropertyItem.</returns>
        private IEnumerable<PropertyItem> CreatePropertyItems(object instance, IPropertyControlOptions options)
        {
            var instanceType = instance.GetType();

            var properties = TypeDescriptor.GetProperties(instance);
            foreach (PropertyDescriptor pd in properties)
            {
                if (options.ShowDeclaredOnly && pd.ComponentType != instanceType)
                {
                    continue;
                }

                // Skip properties marked with [Browsable(false)]
                if (!pd.IsBrowsable)
                {
                    continue;
                }

                // Read-only properties
                if (!options.ShowReadOnlyProperties && pd.IsReadOnly)
                {
                    continue;
                }

                // If RequiredAttribute is set, skip properties that don't have the given attribute
                if (options.RequiredAttribute != null
                    && !AttributeHelper.ContainsAttributeOfType(pd.Attributes, options.RequiredAttribute))
                {
                    continue;
                }

                yield return this.CreatePropertyItem(pd, properties, instance);
            }
        }
        /// <summary>
        /// Creates the property model.
        /// </summary>
        /// <param name="instance">
        /// The instance.
        /// </param>
        /// <param name="isEnumerable">
        /// if set to <c>true</c> [is enumerable].
        /// </param>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <returns>
        /// A list of <see cref="Tab"/> .
        /// </returns>
        public virtual IEnumerable<Tab> CreateModel(object instance, bool isEnumerable, IPropertyControlOptions options)
        {
            if (instance == null)
            {
                return null;
            }

            this.Reset();

            var tabs = new Dictionary<string, Tab>();
            foreach (var pi in this.CreatePropertyItems(instance, options).OrderBy(t => t.SortIndex))
            {
                var tabHeader = pi.Tab ?? string.Empty;
                if (!tabs.ContainsKey(tabHeader))
                {
                    tabs.Add(tabHeader, new Tab { Header = pi.Tab });
                }

                var tab = tabs[tabHeader];
                var group = tab.Groups.FirstOrDefault(g => g.Header == pi.Category);
                if (group == null)
                {
                    group = new Group { Header = pi.Category };
                    tab.Groups.Add(group);
                }

                group.Properties.Add(pi);
            }

            return tabs.Values.ToList();
        }