updated to save to db