Consolidate duplicate record code