/** * Deletes message by ID. * Images connected to the message (WordPress Media Library attachments) are also deleted. * * @param integer $id * * @return null */ public function deleteById($id) { if ($this->messagesDAO->get($id) !== null) { $this->messagesDAO->deleteById($id); $this->attachmentsService->deleteAttachmentsByMessageIds(array($id)); } }