Move logic to Model