Replacing all queries with prepared statements in State Sample class. #278