Implements replace and replace all functionality on findAndReplaceWidget