LPS-44722 Fix Remote Staging turn off problem with page versioning 

Hi Dani,

As you requested in https://github.com/danielkocsis/liferay-portal/pull/381 I refactored the code. Please review it and let me know if you have any concerns.

Cheers,
Vilmos