cleaned up code

Escape is not public so I fix as private.
GenerateInsertSQL method's foreach ran twice. I united it.