/// <summary>
        /// Handler for Closed event, triggered when window is about to close.
        /// </summary>
        /// <param name="sender">Window object</param>
        private void WindowClosed(object sender, EventArgs e)
        {
            Window window = (Window)sender;

            window.Closed -= WindowClosed;

            OpenViews.Remove(window);
        }
        private void DialogWindowClosed(object sender, EventArgs e)
        {
            Window window = (Window)sender;

            window.Closed -= DialogWindowClosed;

            OpenViews.Remove(window);

            var vm = window.DataContext as IDialogViewModel;

            DialogResult = vm.DialogResult;

            Returned = true;
        }