Save assigned pages.

If page is already assigned, just udpate it.

If it doesn't exist yet, create it.

Everytime page assignments are saved, all the pages that were assigned to that component (that were not updated or created) will be deleted. This allows the page to be detached from the component and therefore unassigned.

This algorithm avoids duplicates.