Remove unnecessary query.count() calls by using first()

Since query.first() returns None if there are no rows in the table, there is no
need to count the rows first. Discussed in pull #1.
Merge pull request #2 from fedora-infra/feature/first!

Remove unnecessary query.count() calls by using first()