Add record functionality to a databases collection complete. Time to clean up code and optimize.