public async Task <ObservableCollection <OrgViewModel> > FetchChildren()
        {
            var newOrgsList = new ObservableCollection <OrgViewModel>();

            var orgsResponse = await CloudFoundryService.GetOrgsForCfInstanceAsync(CloudFoundryInstance);

            if (orgsResponse.Succeeded)
            {
                var orgs = new ObservableCollection <CloudFoundryOrganization>(orgsResponse.Content);

                foreach (CloudFoundryOrganization org in orgs)
                {
                    var newOrg = new OrgViewModel(org, this, ParentTasExplorer, Services);
                    newOrgsList.Add(newOrg);
                }
            }
            else if (orgsResponse.FailureType == Toolkit.Services.FailureType.InvalidRefreshToken)
            {
                IsExpanded = false;
                ParentTasExplorer.AuthenticationRequired = true;
            }
            else
            {
                _dialogService.DisplayErrorDialog(_getOrgsFailureMsg, orgsResponse.Explanation);
            }

            return(newOrgsList);
        }
        public SpaceViewModel(CloudFoundrySpace space, OrgViewModel parentOrgViewModel, TasExplorerViewModel parentTasExplorer, IServiceProvider services, bool expanded = false)
            : base(parentOrgViewModel, parentTasExplorer, services, expanded: expanded)
        {
            _dialogService = services.GetRequiredService <IErrorDialog>();
            Space          = space;
            DisplayText    = Space.SpaceName;

            LoadingPlaceholder = new PlaceholderViewModel(parent: this, services)
            {
                DisplayText = LoadingMsg,
            };

            EmptyPlaceholder = new PlaceholderViewModel(parent: this, Services)
            {
                DisplayText = EmptyAppsPlaceholderMsg,
            };
        }
        protected internal override async Task LoadChildren()
        {
            var orgsResponse = await CloudFoundryService.GetOrgsForCfInstanceAsync(CloudFoundryInstance);

            if (orgsResponse.Succeeded)
            {
                if (orgsResponse.Content.Count == 0)
                {
                    var noChildrenList = new ObservableCollection <TreeViewItemViewModel>
                    {
                        EmptyPlaceholder,
                    };

                    Children            = noChildrenList;
                    HasEmptyPlaceholder = true;
                }
                else
                {
                    var updatedOrgsList = new ObservableCollection <TreeViewItemViewModel>();
                    foreach (CloudFoundryOrganization org in orgsResponse.Content)
                    {
                        var newOrg = new OrgViewModel(org, this, ParentTasExplorer, Services);
                        updatedOrgsList.Add(newOrg);
                    }

                    Children            = updatedOrgsList;
                    HasEmptyPlaceholder = false;
                }

                IsLoading = false;
            }
            else
            {
                IsLoading = false;

                _dialogService.DisplayErrorDialog(_getOrgsFailureMsg, orgsResponse.Explanation);

                IsExpanded = false;
            }
        }