After update() method changes the status of all information structures, smartUpdateAllOfBlocks() changes DB by checking these status. How to change DB is decided by the status.
This information structure is loaded. And, the information and another information of the latest collection are not different. Therefore, we don’t need to change DB about this information.
This information structure and another information are different. And, the information has been updated with another information. Therefore, we should update a record of DB about the information. updateBlockByInfo() is a good utility method for that.
This information structure and another information are the same content. But, only their orders are different. Therefore, we should update a order field of a record of DB about the information. Well, blocks don’t have the order information. This status assigns to preferences only.
When the current collection doesn’t have a information, it is added to the current colletion. And, the status of the information is changed to ‘New’. In this case, we have to insert it to DB. insertBlockByInfo() is a good utility method for that.
Since this information structure was not found in the latest collection, the status of the information has been changed to ‘deleted’. In this case, we have to delete it from DB. uinstallBlockByInfo() is a good utility method for that.
smartUpdateAllOfBlocks() and smartUpdateAllOfPreferences() are very useful, because they can implement enough process which I have explained these days. In most cases, you may leave updating to these utility methods. But, if you need advanced updating in your phased upgrade, you should understand these classes.