Moved the logic handling polygon management into a common abstract class.