move several methods from controllers to models