<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_model(self, idx=None):
 """Updates the value of property at given index. If idx is None, all controlled indices will be updated. This method should be called directly by the user in very unusual conditions."""

        if idx is None:
            for w in self._widgets:
                idx = self._get_idx_from_widget(w)
                try: val = self._read_widget(idx)
                except ValueError: pass
                else: self._write_property(val, idx)
                pass
            pass
        else:
            try: val = self._read_widget(idx)
            except ValueError: pass
            else: self._write_property(val, idx)
        return