public async Task <ActionResult <bool> > PostQuestStepProgression(QuestStepProgressionDto questStepProgressionDto)
        {
            if (questStepProgressionDto == null)
            {
                return(BadRequest());
            }

            try
            {
                var resolved = await questStepProgressionDomain.ProgressAsync(questStepProgressionDto);

                return(resolved);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        /// <summary>
        /// Adds a new progress entry to the quest step for the given account.
        /// </summary>
        /// <param name="questStepProgressionDto">Contains the quest step progression data.</param>
        /// <returns>An awaitable task that returns true if the quest step progression has been added.</returns>
        public async Task <bool> ProgressAsync(QuestStepProgressionDto questStepProgressionDto)
        {
            // Get quest steps
            var questStep = await questRepository.GetQuestStepAsync(questStepProgressionDto.QuestStepKey);

            if (questStep == null)
            {
                return(false);
            }

            var existingQuestStepProgression = await questStepProgressionRepository.GetQuestStepProgressionAsync(questStepProgressionDto.QuestStepKey, questStepProgressionDto.Username);

            if (existingQuestStepProgression != null)
            {
                return(false);
            }

            // Check if previous quest step is done
            if (questStep.SortOrder > 0)
            {
                var previousQuestStepDone = await questStepProgressionRepository.IsPreviousQuestStepDone(questStep.QuestKey, questStepProgressionDto.Username, questStep.SortOrder - 1);

                if (!previousQuestStepDone)
                {
                    return(false);
                }
            }

            // Add new quest step progression
            var questStepProgression = new QuestStepProgression
            {
                Username                = questStepProgressionDto.Username,
                QuestStepKey            = questStep.QuestStepKey,
                QuestStepProgressionKey = Guid.NewGuid(),
                ResolvedOn              = DateTime.Now
            };

            questStepProgressionRepository.Save(questStepProgression, ctx => ctx.QuestStepProgression, qsp => qsp.QuestStepProgressionKey == questStepProgression.QuestStepProgressionKey);

            return(true);
        }