updating write to DB