used class methods defined in model instead of raw sql in controller