/// <summary>
        /// Deletes the selected library after prompting the user.
        /// </summary>
        private void DeleteLibrary()
        {
            if (this.ActiveLibrary == null)
            {
                OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "No library selected");
                return;
            }

            MessageBoxResult result = CenteredDialogBox.Show(
                "Delete library '" + this.ActiveLibrary.LibraryName + "'?",
                "Confirm Library Delete",
                MessageBoxButton.YesNoCancel,
                MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                Task.Run(() =>
                {
                    try
                    {
                        AccessTokens accessTokens = SettingsViewModel.GetInstance().AccessTokens;
                        SqualrApi.DeleteLibrary(accessTokens?.AccessToken, this.ActiveLibrary.LibraryId);
                        this.libraries.Remove(this.ActiveLibrary);
                        this.ActiveLibrary = null;
                        this.RaisePropertyChanged(nameof(this.Libraries));
                        this.RaisePropertyChanged(nameof(this.ActiveLibrary));
                    }
                    catch (Exception ex)
                    {
                        OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Error deleting library", ex);
                    }
                });
            }
        }
        /// <summary>
        /// Deletes the selected project explorer items.
        /// </summary>
        private void DeleteSelection(Boolean promptUser = true)
        {
            if (this.SelectedProjectItems.IsNullOrEmpty())
            {
                return;
            }

            if (promptUser)
            {
                System.Windows.MessageBoxResult result = CenteredDialogBox.Show(
                    System.Windows.Application.Current.MainWindow,
                    "Delete selected items?",
                    "Confirm",
                    System.Windows.MessageBoxButton.OKCancel,
                    System.Windows.MessageBoxImage.Warning);

                if (result != System.Windows.MessageBoxResult.OK)
                {
                    return;
                }
            }

            foreach (ProjectItem projectItem in this.SelectedProjectItems.ToArray())
            {
                this.ProjectItems.Remove(projectItem);
            }

            this.SelectedProjectItems = null;
        }
        /// <summary>
        /// Prompts the user to save the project if there are unsaved changes.
        /// </summary>
        /// <returns>Returns false if canceled, otherwise true.</returns>
        public Boolean PromptSave()
        {
            if (!this.HasUnsavedChanges)
            {
                return(true);
            }

            String projectName = Path.GetFileName(this.ProjectFilePath);

            if (String.IsNullOrWhiteSpace(projectName))
            {
                projectName = "Untitled";
            }

            MessageBoxResult result = CenteredDialogBox.Show(
                "Save changes to project " + projectName + "?",
                "Unsaved Changes",
                MessageBoxButton.YesNoCancel,
                MessageBoxImage.Question);

            if (result == MessageBoxResult.Cancel)
            {
                return(false);
            }

            if (result == MessageBoxResult.Yes)
            {
                this.SaveProject();
            }

            return(true);
        }
        /// <summary>
        /// Deletes all selected project items.
        /// </summary>
        private void DeleteSelectedItems()
        {
            if (this.GetSelectedProjectItems().IsNullOrEmpty())
            {
                return;
            }

            System.Windows.MessageBoxResult result = System.Windows.MessageBoxResult.No;
            ControlThreadingHelper.InvokeControlAction(
                this.projectExplorerTreeView,
                () =>
            {
                result = CenteredDialogBox.Show(
                    System.Windows.Application.Current.MainWindow,
                    "Delete selected items?",
                    "Confirm",
                    System.Windows.MessageBoxButton.OKCancel,
                    System.Windows.MessageBoxImage.Warning);
            });

            if (result == System.Windows.MessageBoxResult.OK)
            {
                ProjectExplorerViewModel.GetInstance().DeleteSelectionCommand.Execute(null);
            }
        }