model.setPersonId(measure.getPersonId());
model.setValue(measure.getValue());
if (measure instanceof RuleMeasure) {
RuleMeasure ruleMeasure = (RuleMeasure) measure;
model.setRulePriority(ruleMeasure.getSeverity());
RuleKey ruleKey = ruleMeasure.ruleKey();
if (ruleKey != null) {
Rule ruleWithId = ruleFinder.findByKey(ruleKey);
if (ruleWithId == null) {
throw new IllegalStateException("Can not save a measure with unknown rule " + ruleMeasure);
}