$sql3 .= "and contact_uuid = '" . $row['contact_uuid'] . "' ";
                 $prep_statement3 = $db->prepare(check_sql($sql3));
                 $prep_statement3->execute();
                 unset($sql3, $prep_statement3);
             }
             unset($sql2, $result2, $prep_statement2);
         }
     }
 }
 unset($obj);
 //populate primary url from deprecated field in v_contact table
 $obj = new schema();
 $obj->db = $db;
 $obj->db_type = $db_type;
 $obj->schema();
 $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url');
 //check if field exists
 if ($field_exists) {
     // get email records
     $sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
     $prep_statement = $db->prepare(check_sql($sql));
     $prep_statement->execute();
     $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     $result_count = count($result);
     unset($prep_statement, $sql);
     if ($result_count > 0) {
         foreach ($result as $row) {
             $sql = "insert into v_contact_urls ";
             $sql .= "(";
             $sql .= "domain_uuid, ";
             $sql .= "contact_uuid, ";