private Map<Variable, Term> substituteResult(
            List<UnificationPair> mgu, Map<Variable, Term> substitutions) {
        for (UnificationPair termPair : mgu) {
            for (Map.Entry<Variable, Term> substitution : substitutions.entrySet()) {
                substitution.setValue(substitution.getValue().substitute(
                        termPair.getLhs(), termPair.getRhs()));
            }
        }

        return substitutions;
    }