Add a method for checking if an attribute has changed