Modified insertQuery to include id in results