Created a method to compare KeyValuePairs