Database functionality.