Refactored GetRecords to eliminate duplicate code