def update(self, instance):
        """ method finds unit_of_work record and change its status"""
        assert isinstance(instance, UnitOfWork)
        if instance.db_id:
            query = {'_id': ObjectId(instance.db_id)}
        else:
            query = {unit_of_work.PROCESS_NAME: instance.process_name,
                     unit_of_work.TIMEPERIOD: instance.timeperiod,
                     unit_of_work.START_ID: instance.start_id,
                     unit_of_work.END_ID: instance.end_id}
        self.ds.update(COLLECTION_UNIT_OF_WORK, query, instance)
        return instance.db_id