move business logic from controllers to models