/// <summary>
        /// Connect to MS SQL Server
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ConnectToMsSql_OnExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            await DiagramFacade.CloseDiagramsOnDisconnect(this);

            SessionProvider.Instance.Disconnect();
            DatabaseConnectionSidebar.HideDatabaseStackPanels();

            ProgressDialogController progressDialogController = null;

            Func <ProgressDialogController, Task> closeProgress = async t =>
            {
                if (t != null)
                {
                    if (t.IsOpen)
                    {
                        await t.CloseAsync();
                    }
                }
            };

            try
            {
                progressDialogController = await this.ShowProgressAsync("Please wait", "Connecting to server...", false, new MetroDialogSettings()
                {
                    AnimateShow = false,
                    AnimateHide = false
                });

                progressDialogController.SetIndeterminate();

                MsSqlDatabase db = new MsSqlDatabase();
                string        name = null, pass = null;
                bool          integratedSecurity = true;

                var server = MsSqlServerNameTextBox.Text;
                if (WinAuthSwitch.IsChecked != null)
                {
                    integratedSecurity = !WinAuthSwitch.IsChecked.Value;
                }

                if (!integratedSecurity)
                {
                    name = MsSqlUsernameTextBox.Text;
                    pass = MsSqlPasswordBox.Password;
                }

                await db.BuildSession(server, integratedSecurity, name, pass);

                await closeProgress(progressDialogController);

                await this.ShowMessageAsync("Connected", $"Successfuly connected to {SessionProvider.Instance.ServerName}");

                var flyout = Flyouts.Items[0] as Flyout;

                if (flyout != null)
                {
                    flyout.IsOpen = !flyout.IsOpen;
                }

                await DatabaseConnectionSidebar.LoadMsSqlData();
            }
            catch (SqlException exception)
            {
                await closeProgress(progressDialogController);

                await this.ShowMessageAsync("Connection error", exception.Message);

                SessionProvider.Instance.ConnectionType = ConnectionType.None;
            }
        }