Fix save function to actually update database record. Add a test.