update database after sale