move calculating result method into model