reduce code duplication in remove($elementOrFieldset) method