It looks like you could make this and `_set_dirty` a generic function that both use.