public void SetFromScanOutput(ScanOutput scanOutput, AnswerKeyOpticalForm answerKeyOpticalForm) { ScanOutput = scanOutput; foreach (var answerKeyOpticalFormSection in answerKeyOpticalForm .Sections .Where(s => s.FormPart == scanOutput.FormPart)) { var studentOpticalFormSection = new StudentOpticalFormSection(answerKeyOpticalFormSection); for (var i = 0; i < answerKeyOpticalFormSection.Answers.Count; i++) { var correctAnswer = answerKeyOpticalFormSection.Answers.ElementAt(i); var questionAnswer = new QuestionAnswer(i + 1, scanOutput.Next()); questionAnswer.SetCorrectAnswer(correctAnswer); studentOpticalFormSection.Answers.Add(questionAnswer); } scanOutput.Skip(answerKeyOpticalFormSection.MaxQuestionCount - answerKeyOpticalFormSection.Answers.Count); Sections.Add(studentOpticalFormSection); } }