savekey to database