LPS-35675

Hey Milen,

I had to make quite a few changes to adapt the code to Liferay's style. I'd appreciate if you can review it and test it.

Once you review it I'll rearrange the commits to make it easier to review and send it to Brian