private void UpdateFavoritesTree(Favorite?selectedFavorite) { FavoritesTree.SuspendLayout(); FavoritesTree.Nodes.Clear(); FavoritesTreeImageList.Images.Clear(); AddToTreeView(FavoritesTree.Nodes, Favorites); FavoritesTree.ExpandAll(); FavoritesTree.ResumeLayout(); if (selectedFavorite is null) { FavoritesTree.SelectedNode = null; } else { FavoritesTree.SelectedNode = FindTreeNodeByFavorite(selectedFavorite); } }