Moved all business logic to the models.