Updated insert method to support insert ignore and on duplicate key update