added extension method for encapsulating logic for generating class
pairs