Use ORM instead of raw SQL to fetch selected service

Otherwise it will fail within a transaction.
While I'm here remove trailing spaces.