private async Task LoadAllTasksAsync()
        {
            try
            {
                GraphServiceClient graphClient = await GraphServiceHelper.GetGraphServiceClientAsync();

                if (graphClient != null)
                {
                    IPlannerPlanTasksCollectionPage tasks    = await graphClient.Planner.Plans[PlanId].Tasks.Request().GetAsync();
                    Dictionary <string, string>     buckets  = Buckets.ToDictionary(s => s.Id, s => s.Name);
                    List <PlannerTaskViewModel>     taskList = new List <PlannerTaskViewModel>();
                    PlannerPlan plan = Plans.FirstOrDefault(s => s.Id == InternalPlanId);
                    while (true)
                    {
                        foreach (PlannerTask task in tasks)
                        {
                            PlannerTaskViewModel taskViewModel = new PlannerTaskViewModel(task);
                            if (plan != null)
                            {
                                taskViewModel.GroupId = plan.Owner;
                            }

                            taskViewModel.PropertyChanged += TaskViewModel_PropertyChanged;
                            await GetAssignmentsAsync(taskViewModel, graphClient);

                            if (!string.IsNullOrEmpty(taskViewModel.BucketId) && buckets.ContainsKey(taskViewModel.BucketId))
                            {
                                taskViewModel.BucketName = buckets[taskViewModel.BucketId];
                            }

                            taskList.Add(taskViewModel);
                        }

                        if (tasks.NextPageRequest == null)
                        {
                            break;
                        }

                        tasks = await tasks.NextPageRequest.GetAsync();
                    }

                    _allTasks.Clear();
                    _allTasks.AddRange(taskList);
                    LoadTasks();
                }
            }
            catch (Exception exception)
            {
                MessageDialog messageDialog = new MessageDialog(exception.Message);
                await messageDialog.ShowAsync();
            }
        }
        private async void Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                GraphServiceClient graphClient = await GraphServiceHelper.GetGraphServiceClientAsync();

                if (graphClient != null &&
                    !string.IsNullOrWhiteSpace(_input?.Text))
                {
                    PlannerTask task = new PlannerTask
                    {
                        Title = _input.Text
                    };
                    if (TaskType != TaskTypeAllTasksId && TaskType != TaskTypeClosedTasksId)
                    {
                        task.BucketId = TaskType;
                    }

                    task.PlanId = PlanId;
                    _input.Text = string.Empty;
                    CanAddTask  = false;
                    PlannerTask taskCreated = await graphClient.Planner.Tasks.Request().AddAsync(task);

                    PlannerPlan                 plan          = Plans.FirstOrDefault(s => s.Id == InternalPlanId);
                    PlannerTaskViewModel        taskViewModel = new PlannerTaskViewModel(taskCreated);
                    Dictionary <string, string> buckets       = Buckets.ToDictionary(s => s.Id, s => s.Name);
                    if (plan != null)
                    {
                        taskViewModel.GroupId = plan.Owner;
                    }

                    if (!string.IsNullOrEmpty(taskViewModel.BucketId) && buckets.ContainsKey(taskViewModel.BucketId))
                    {
                        taskViewModel.BucketName = buckets[taskViewModel.BucketId];
                    }

                    if (taskCreated.PlanId == InternalPlanId)
                    {
                        taskViewModel.PropertyChanged += TaskViewModel_PropertyChanged;
                        _allTasks.Add(taskViewModel);
                        Tasks.Insert(0, taskViewModel);
                    }
                }
            }
            catch (Exception exception)
            {
                MessageDialog messageDialog = new MessageDialog(exception.Message);
                await messageDialog.ShowAsync();
            }

            CanAddTask = true;
        }