public questStatus Read(FilterFolderViewModel viewModel, out FilterFolderViewModel filterFolderViewModel)
        {
            // Initialize
            questStatus status = null;

            filterFolderViewModel = null;


            // Read filter
            FolderId            folderId         = new FolderId(viewModel.Id);
            List <FilterFolder> filterFolderList = null;
            FilterFoldersMgr    filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            status = filterFoldersMgr.Load(folderId, out filterFolderList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model
            filterFolderViewModel = new FilterFolderViewModel();
            BufferMgr.TransferBuffer(viewModel, filterFolderViewModel);
            foreach (FilterFolder filterFolder in filterFolderList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterFolder, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterFolderViewModel.Items.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Save(FilterFolderViewModel filterFolderViewModel)
        {
            // Initialize
            questStatus status = null;


            // Transfer model
            Quest.Functional.MasterPricing.FilterFolder filterFolder = new Functional.MasterPricing.FilterFolder();
            BufferMgr.TransferBuffer(filterFolderViewModel, filterFolder, true);
            if (filterFolderViewModel.FolderId < BaseId.VALID_ID)
            {
                filterFolder.FolderId = null;
            }


            // Determine if this is a create or update
            FilterFoldersMgr filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            if (filterFolderViewModel.Id < BaseId.VALID_ID)
            {
                // Create
                FilterFolderId filterFolderId = null;
                status = filterFoldersMgr.Create(filterFolder, out filterFolderId);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, filterFolderViewModel);
                    return(status);
                }
                filterFolderViewModel.Id = filterFolderId.Id;
            }
            else
            {
                // Update
                status = filterFoldersMgr.Update(filterFolder);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, filterFolderViewModel);
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Read(TablesetId tablesetId, out DataMgrTablesetViewModel dataMgrTablesetViewModel)
        {
            // Initialize
            questStatus status = null;

            dataMgrTablesetViewModel = null;


            // Read tableset data management.
            TablesetDataManagement tablesetDataManagement = null;
            TablesetMgr            tablesetMgr            = new TablesetMgr(this.UserSession);

            status = tablesetMgr.ReadTablesetDataManagement(tablesetId, out tablesetDataManagement);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // List lookups
            DatabaseId databaseId = new DatabaseId(tablesetDataManagement.TablesetConfiguration.Database.Id);
            List <BootstrapTreenodeViewModel> lookupNodeList = null;

            status = ListLookups(databaseId, out lookupNodeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // List TypeLists
            List <BootstrapTreenodeViewModel> typeListNodeList = null;

            status = ListTypeLists(databaseId, out typeListNodeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Load all folders
            FolderId            folderId         = null;
            List <FilterFolder> filterFolderList = null;
            FilterFoldersMgr    filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            status = filterFoldersMgr.Load(folderId, out filterFolderList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Build model
            dataMgrTablesetViewModel            = new DataMgrTablesetViewModel(this.UserSession, this._dataMgrBaseViewModel);
            dataMgrTablesetViewModel.TablesetId = tablesetId.Id;
            BufferMgr.TransferBuffer(tablesetDataManagement.TablesetConfiguration.Tableset, dataMgrTablesetViewModel.Tableset);
            if (dataMgrTablesetViewModel.Tableset.Summary == null)
            {
                dataMgrTablesetViewModel.Tableset.Summary = "";
            }
            dataMgrTablesetViewModel.Tableset.LastRefresh = "";
            dataMgrTablesetViewModel.Tableset.LastRefresh = tablesetDataManagement.TablesetConfiguration.Tableset.LastRefresh.HasValue ?
                                                            tablesetDataManagement.TablesetConfiguration.Tableset.LastRefresh.Value.ToString("MM/dd/yyyy HH:mm:ss") : "";


            foreach (TablesetTable tablesetTable in tablesetDataManagement.TablesetConfiguration.TablesetTables)
            {
                tablesetTable.bColumnsSelectable = false;
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.TableList.Add(bootstrapTreenodeViewModel);
            }
            foreach (TablesetView tablesetView in tablesetDataManagement.TablesetConfiguration.TablesetViews)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetView, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.ViewList.Add(bootstrapTreenodeViewModel);
            }

            dataMgrTablesetViewModel.Lookups   = lookupNodeList;
            dataMgrTablesetViewModel.TypeLists = typeListNodeList;


            foreach (FilterFolder filterFolder in filterFolderList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterFolder, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.Folders.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }