///--------------------------------------------------------------------------------
        /// <summary>This method refreshes the view model.</summary>
        ///
        /// <param name="refreshChildren">Flag indicating whether children should be refreshed.</param>
        ///--------------------------------------------------------------------------------
        public void Refresh(bool refreshChildren, int refreshLevel = 0)
        {
            if (refreshChildren == true || refreshLevel > 0)
            {
            }

            #region protected
            #endregion protected

            HasErrors         = !IndexProperty.IsValid;
            HasCustomizations = IndexProperty.IsAutoUpdated == false || IndexProperty.IsEmptyMetadata(IndexProperty.ForwardInstance) == false || ChildrenHaveAnyCustomizations();
            if (HasCustomizations == false && IndexProperty.ReverseInstance != null)
            {
                // remove customizations if solely due to child customizations no longer present
                IndexProperty.IsAutoUpdated  = true;
                IndexProperty.SpecSourceName = IndexProperty.ReverseInstance.SpecSourceName;
                IndexProperty.ResetModified(IndexProperty.ReverseInstance.IsModified);
                IndexProperty.ResetLoaded(IndexProperty.ReverseInstance.IsLoaded);
                if (!IndexProperty.IsIdenticalMetadata(IndexProperty.ReverseInstance))
                {
                    HasCustomizations           = true;
                    IndexProperty.IsAutoUpdated = false;
                }
            }
            if (HasCustomizations == false)
            {
                // clear customizations
                IndexProperty.ForwardInstance = null;
                IndexProperty.ReverseInstance = null;
                IndexProperty.IsAutoUpdated   = true;
            }
            OnPropertyChanged("Items");
            OnPropertyChanged("HasCustomizations");
            OnPropertyChanged("HasErrors");
        }