sending to db function