Factored out contest existence checking.