public async void Load() { Exception occurredException = null; try { var projects = await projectDataService.GetAllByUserAccount(authenticator.CurrentUser); Projects = new ObservableCollection <ProjectModel>(); // map each project and add it to the list if (projects == null) { return; } foreach (var project in projects) { var mappedProject = new ProjectModel(project); Projects.Add(mappedProject); // map tasks of the project if (project.Tasks == null) { continue; } foreach (var projectTask in project.Tasks) { mappedProject.Tasks.Add(new ProjectTaskModel(projectTask)); } } } catch (Exception exception) { Debug.WriteLine("An error occurred while loading the projects."); occurredException = exception; } finally { ProjectsLoaded?.Invoke(this, new ProjectsLoadedEventArgs(occurredException)); } }