Prevent Duplicate Inserts

Refactored QueryData methods