filter->getCollection($this->collectionFactory->create()); $deleted = 0; foreach ($collection as $submission) { $submission->delete(); $deleted++; } $this->messageManager->addSuccessMessage(__('A total of %1 message(s) have been deleted.', $deleted)); return $this->resultRedirectFactory->create()->setPath('*/*/'); } }