You probably want to add an ``if count > 0:`` condition here, to avoid running useless queries. :)