Moves some functionality and exceptions into models from controllers.