Functions to DB.