This is a list of regular expressions which help to find LINQ mistakes (#3).
use: \.Single(OrDefault)?\(.*\)
use: \.First(OrDefault)?\(.*\)
use: \.Count\(\)
use: \.Count\(.*\)
or in this case if.*\(.*\.Count\(.*\)\)
might help.
use: \.Where\(.*\)\.First(OrDefault)?\(.*\)
use: \.Where\(.*\)\.Where\(.*\)
use: \.OrderBy\(.*\)\.OrderBy\(.*\)
use: \.Select\((\w)\s*=>\s*\1\)