/// <summary>
        /// for getting continuous learning attempts
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="attempt"></param>
        /// <param name="quizDetails"></param>
        /// <returns></returns>
        public List <QuizAttempts> GetContinuousLearningQuizAttempts(string userId, int attempt, QuizDetails quizDetails)
        {
            var userFilter = Builders <BsonDocument> .Filter.Eq("userid", userId);

            var latestAttempt          = _continuousLearningAdapter.GetLatestAttemptByUser(userId);
            List <BsonDocument> result = new List <BsonDocument>();

            if (latestAttempt != null)
            {
                if (attempt == 1)
                {
                    var attemptFilter = Builders <BsonDocument> .Filter.Eq("attemptcount", latestAttempt.attemptcount);

                    var userAndAttempt = Builders <BsonDocument> .Filter.And(userFilter, attemptFilter);

                    result = _quizAttempt.GetRecords(_continuousLearningAttemptsCollection, userAndAttempt);
                }
                else
                {
                    if (latestAttempt.attemptcount > 1)
                    {
                        var attemptFilter = Builders <BsonDocument> .Filter.Eq("attemptcount", latestAttempt.attemptcount - 1);

                        var userAndAttempt = Builders <BsonDocument> .Filter.And(userFilter, attemptFilter);

                        result = _quizAttempt.GetRecords(_continuousLearningAttemptsCollection, userAndAttempt);
                    }
                }
            }

            var continuousLearningQuizzes = _continuousLearningAdapter.GetContinuousLearningAssessmentQuizzes();

            List <QuizAttempts> quizAttempts = new List <QuizAttempts>();

            foreach (var item in result)
            {
                item.TryGetValue("answer", out BsonValue answerValue);
                item.TryGetValue("userid", out BsonValue useridValue);
                item.TryGetValue("attemptcount", out BsonValue attemptValue);
                item.TryGetValue("questionid", out BsonValue questionidValue);
                item.TryGetValue("yes", out BsonValue yesValue);
                item.TryGetValue("somewhat", out BsonValue somewhatValue);
                item.TryGetValue("no", out BsonValue noValue);
                var answer = Common.BooleanNullCheck(yesValue) ? "Yes" : Common.BooleanNullCheck(somewhatValue) ? "Somewhat" : "No";

                var question = continuousLearningQuizzes.Where(a => a.id == Common.IntegerNullCheck(questionidValue));
                quizAttempts.Add(new QuizAttempts
                {
                    question = question.Count() == 0 ? "" : question.Select(a => a.question).FirstOrDefault().ToString(CultureInfo.InvariantCulture),
                    answer   = answer,
                    userId   = Common.StringNullCheck(useridValue),
                    attempt  = Common.IntegerNullCheck(attemptValue),
                    type     = quizDetails.type
                });
            }

            return(quizAttempts);
        }
 public List <ContinuousLearningAssessmentQuiz> GetContinuousLearningAssessmentQuizzes()
 {
     return(_continuousLearningAdapter.GetContinuousLearningAssessmentQuizzes());
 }