Undo functionality

Added a new function that will revert any changes made to the tracked object and reset the dirty flag.