/**
  * @return ContactForm
  */
 public function createForm(Contact $contact = null)
 {
     $contact = $contact ? $contact : new Contact();
     $this->form = $this->serviceLocator->get('AddressBook\\Form\\Contact');
     $this->form->bind($contact);
     return $this->form;
 }
 public function insert($data)
 {
     $contact = new \AddressBook\Entity\Contact();
     $hydrator = new \DoctrineModule\Stdlib\Hydrator\DoctrineObject($this->em);
     $inputFilter = new \AddressBook\InputFilter\ContactInputFilter($this->em);
     $this->form->setInputFilter($inputFilter);
     $this->form->setData($data);
     if ($this->form->isValid()) {
         $hydrator->hydrate((array) $data, $contact);
         $this->em->persist($contact);
         $this->em->flush();
         return true;
     }
     return false;
 }