Updated to fetch data from database and persist changes