/**
  * Saves the phone details to the database.
  *
  * @param \PhoneDirectory\Entity\PhoneBook $phoneBook
  */
 public function save($phoneBook)
 {
     $phoneBookObj = array('name' => $phoneBook->getName(), 'phone_number' => $phoneBook->getPhoneNumber(), 'additional_notes' => $phoneBook->getAdditionalNotes());
     if (!$phoneBook->getId()) {
         $phoneBookObj['date_created'] = date("d M Y");
         $phoneBookObj['date_updated'] = date("Y-m-d H:i:s");
         $this->db->insert('phone_details', $phoneBookObj);
         // Get the id of the newly created phone record and set it on the entity.
         $id = $this->db->lastInsertId();
         $phoneBook->setId($id);
     } else {
         $phoneBookObj['date_updated'] = date("Y-m-d H:i:s");
         $this->db->update('phone_details', $phoneBookObj, array('id' => $phoneBook->getId()));
     }
 }