Working with a list of checkboxes, keeping checked state in sync with server data can sometimes be challenging.
Here I've tried to distill the logic down to be as simple as possible.
Reference: Official Docs