public void FillSolvedTests() { SolvedTests.Clear(); foreach (var history in _dao.GetAllHistories()) { if (history.User.Name == UserName || _dao.IsEditor(UserName) == true) { //gonna do a function from that List <List <int> > checkedAnswers = _dao.SelectCheckedAnswers(history.Id); history.ChosenAnswers = new List <IAnsweredQuestion>(); int count = history.Question.Count; for (int i = 0; i < count; i++) { if (checkedAnswers.Count > i) { if (history.ChosenAnswers.Count <= i) { history.ChosenAnswers.Add(_dao.CreateNewAnsweredQuestion()); } history.ChosenAnswers[i].ChosenAnswers = checkedAnswers[i]; //adding list of integers (answer) from questionid = i } else { history.Question.RemoveAt(history.Question.Count - 1); } } SolvedTests.Add(history); } } }