Refactor collection clear operation.