move method to model and add test-unit