private async Task CreateCustomStudy()
        {
            var deck = collection.Deck.Current();

            if (HandleNotCreatingDynamicDeckCases(deck))
            {
                return;
            }

            //Not in java and python ver, we do nothing if no cards are available
            if (studyOption != CustomStudyOption.CramMode)
            {
                var max = int.Parse(chosenLabelValue.Text);
                if (max == 0)
                {
                    return;
                }
            }

            customStudyFlyout.IsOpen = false;
            JsonObject dynamicDeck;
            long       deckId;
            var        currentCustomDeck = collection.Deck.GetDeckByName(DEFAULT_DYN_DECKNAME);

            if (currentCustomDeck != null)
            {
                deckId = (long)currentCustomDeck.GetNamedNumber("id");
                bool isDyn = collection.Deck.IsDyn(deckId);
                if (!isDyn)
                {
                    await UIHelper.ShowMessageDialog("Please rename the deck named \"" + DEFAULT_DYN_DECKNAME + "\" to another name first.");

                    return;
                }
                else
                {
                    collection.Sched.EmptyDyn(deckId);
                    dynamicDeck = currentCustomDeck;
                    collection.Deck.Select(deckId);
                }
            }
            else
            {
                deckId      = collection.Deck.NewDynamicDeck(DEFAULT_DYN_DECKNAME);
                dynamicDeck = collection.Deck.Get(deckId);
            }
            ProgressDialog dialog = new ProgressDialog();

            dialog.ProgressBarLabel = "Buidling custom study deck...";
            dialog.ShowInDeterminateStateNoStopAsync("Custom Study");

            CreateDynamicDeckConfigs(dynamicDeck, deck);

            var task = Task.Run(async() =>
            {
                var cards = collection.Sched.RebuildDyn();
                collection.SaveAndCommitAsync();

                await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    if (cards == null || cards.Count == 0)
                    {
                        await UIHelper.ShowMessageDialog(UIConst.WARN_CUSTOM_STUDY_NOCARDS_MATCH);
                    }

                    CustomStudyCreateEvent?.Invoke(studyOption, deckId);
                    dialog.Hide();
                });
            });
        }