recording to database