public function afterSubscribeCustomerById($subscriber)
 {
     $storeId = $subscriber->getStoreId();
     if ($this->_helper->isMonkeyEnabled($storeId)) {
         $customer = $this->_customer;
         $mergeVars = $this->_helper->getMergeVars($customer);
         $api = new \Ebizmarts\MageMonkey\Model\Api(array(), $this->_helper);
         $isSubscribeOwnEmail = $this->_customerSession->isLoggedIn() && $this->_customerSession->getCustomerDataObject()->getEmail() == $subscriber->getSubscriberEmail();
         if ($this->_helper->isDoubleOptInEnabled($storeId) && !$isSubscribeOwnEmail) {
             $status = 'pending';
         } else {
             $status = 'subscribed';
         }
         $data = array('list_id' => $this->_helper->getDefaultList(), 'email_address' => $subscriber->getEmail(), 'email_type' => 'html', 'status' => $status);
         $return = $api->listCreateMember($this->_helper->getDefaultList(), json_encode($data));
         if (isset($return->id)) {
             $subscriber->setMagemonkeyId($return->id)->save();
         }
     }
 }
 public function aroundDelete(\Magento\Newsletter\Model\Subscriber $subscriber, \Closure $proceed)
 {
     $monkeyId = $subscriber->getMagemonkeyId();
     $result = $proceed();
     if ($monkeyId) {
     }
     $api = new \Ebizmarts\MageMonkey\Model\Api(array(), $this->_helper);
     $return = $api->listDeleteMember($this->_helper->getDefaultList(), $monkeyId);
     $result->setMagemonkeyId('')->save();
     return $result;
 }