Applied foreach design pattern to _where function.