Update data in database and apply ui to the form