Move sql-query to model