/**
  *
  * @param RP_Family_Record $family
  */
 function add_fam($family, $options)
 {
     $need_update = false;
     $famid = null;
     $fam = new RP_Fam();
     $fam->id = $family->id;
     $fam->batch_id = $this->batch_id;
     $fam->restriction_notice = $family->restriction;
     $fam->spouse1 = $family->husband;
     $fam->indi_batch_id1 = $this->batch_id;
     $fam->spouse2 = $family->wife;
     $fam->indi_batch_id2 = $this->batch_id;
     $fam->auto_rec_id = $family->auto_rec_id;
     $fam->ged_change_date = $family->change_date->date;
     try {
         $famid = RP_Dao_Factory::get_rp_fam_dao($this->credentials->prefix)->insert($fam);
         $family->id = $famid;
     } catch (Exception $e) {
         if (stristr($e->getMessage(), 'Duplicate entry') >= 0) {
             $need_update = true;
         } else {
             error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0);
             echo $e->getMessage();
             throw $e;
         }
     }
     if ($need_update) {
         try {
             RP_Dao_Factory::get_rp_fam_dao($this->credentials->prefix)->update($fam);
         } catch (Exception $e) {
             error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0);
             echo $e->getMessage();
             throw $e;
         }
     }
     $this->update_children($family, $options);
     if (!isset($options['editMode'])) {
         $this->update_fam_events($family);
     }
     return $famid;
 }