/// <inheritdoc />
        /// <summary>
        /// Initializes a new instance of the <see cref="T:BusinessLogicWPF.View.Admin.UserControls.AddTrain" /> class.
        /// </summary>
        public AddTrain()
        {
            this.InitializeComponent();

            this.DataContext = new AddTrainViewModel();

            this.MainGrid.Visibility        = Visibility.Visible;
            this.NavigateToRoute.Visibility = Visibility.Collapsed;

            // ComboBox Section
            if (DataHelper.StationsList != null)
            {
                this.sourceStations = DataHelper.StationsList.Stations.Values.ToList();
            }

            this.ComboBoxTrainSource.ItemsSource      = this.sourceStations;
            this.ComboBoxTrainDestination.ItemsSource = this.sourceStations;

            // TreeView Section
            this.root = new MenuItem {
                Name = "Coach"
            };

            // We should delete this part as here we are initializing the whole list for coaches
            var enumerable = this.list;

            if (enumerable != null)
            {
                foreach (var item in enumerable)
                {
                    var observableCollection = this.root.Items;
                    observableCollection?.Add(new MenuItem {
                        Name = item
                    });
                }
            }

            this.TreeView.Items.Add(this.root);
        }
        /// <summary>
        /// The button add on click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private async void ButtonAddOnClick([CanBeNull] object sender, [CanBeNull] RoutedEventArgs e)
        {
            try
            {
                if (string.Compare(this.currentSelectedItem, "Coach", StringComparison.Ordinal) == 0)
                {
                    var dialog1 = new SelectionDialog {
                        DataContext = new SelectCoachCategoryViewModel()
                    };

                    var result1 = await DialogHost.Show(dialog1, "RootDialog")
                                  .ConfigureAwait(false);

                    if ((bool)result1)
                    {
                        this.Dispatcher.Invoke(
                            () =>
                        {
                            var coaches = this.root.Items ?? throw new InvalidOperationException();

                            var item = new MenuItem {
                                Name = DataHelper.SelectedCoach
                            };

                            if (!coaches.Contains(item))
                            {
                                coaches.Add(item);
                            }

                            this.TreeView.Items[0] = this.root;
                        });
                    }
                }
                else
                {
                    var o = this.list;
                    if (o?.Contains(this.currentSelectedItem) == true)
                    {
                        DataHelper.SelectedCoach = (this.list ?? throw new InvalidOperationException()).FirstOrDefault(
                            a => a.Contains(this.currentSelectedItem ?? throw new InvalidOperationException()));
                        var dialog2 = new SelectionDialog {
                            DataContext = new EnterCoachesViewModel()
                        };

                        var result2 = await DialogHost.Show(dialog2, "RootDialog")
                                      .ConfigureAwait(false);

                        if ((bool)result2)
                        {
                            this.Dispatcher.Invoke(
                                () =>
                            {
                                var coaches =
                                    (this.root.Items ?? throw new InvalidOperationException()).FirstOrDefault(
                                        c => c.Name == DataHelper.SelectedCoach);

                                if (DataHelper.CoachesList != null)
                                {
                                    foreach (var coach in DataHelper.CoachesList)
                                    {
                                        coaches?.Items?.Add(new MenuItem {
                                            Name = coach
                                        });
                                    }
                                }

                                this.TreeView.Items[0] = this.root;
                            });
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid request!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }