/**
  * @param string $name
  *
  * @return int
  * @throws ContactListNotCreated
  */
 public function convert($name)
 {
     $name = Inflector::classify($name);
     if (($contactList = $this->repository->findOneByName($name)) instanceof ContactList) {
         return $contactList->getListId();
     }
     $body = ['Name' => $name];
     $response = $this->client->post(Resources::$Contactslist, ['body' => $body]);
     if (!$response->success()) {
         throw new ContactListNotCreated();
     }
     $contactList = new ContactList();
     $contactList->setName($name);
     $contactList->setListId($response->getData()[0]['ID']);
     $this->objectManager->persist($contactList);
     $this->objectManager->flush($contactList);
     return $contactList->getListId();
 }