Fix database transaction scope for resources endpoint

Prior to this commit, the database transaction scope for
the `resources` endpoint did not encapsulate the `get-result-count`
call; this caused an error when handling requests that asked
for the count header.
Merge pull request #717 from cprice404/bug/master/no-db-conn-for-resource-count

Fix database transaction scope for resources endpoint