private void fillTransitions() {
        transitions = new int[template.getAnswerGroups().size()];

        for (int i = 0; i < template.getAnswerGroups().size(); i++) {
            AnswerGroup answerGroup = template.getAnswerGroups().get(i);

            int j = i + 1;
            if (j >= template.getAnswerGroups().size()) {
                break;
            }

            int size = answerGroup.getAnswers().size();

            while (j < template.getAnswerGroups().size()) {

                AnswerGroup anotherGroup = template.getAnswerGroups().get(j);
                int anotherSize = answerGroup.getAnswers().size();
                int minSize = anotherSize > size ? size : anotherSize;

                boolean contains = true;

                for (int m = 0; m < minSize; m++) {
                    if (anotherGroup.getAnswers().get(m).getQuestionNumber()
                            != answerGroup.getAnswers().get(m).getQuestionNumber()) {
                        contains = false;
                        break;
                    }
                }

                if (contains) {
                    j++;
                } else {
                    break;
                }
            }

            transitions[i] = j;
        }

        transitions[template.getAnswerGroups().size() - 1] = template.getAnswerGroups().size();
    }