can you make this a helper method.. SQL queries in view is not kosher IMO