Move logic to a model