function copy_to($id, $parent_id, $user_id, $options = null, $mappings = null)
 {
     $my['options'] = array('check_duplicate_name' => 0, 'action_on_duplicate_name' => 'allow_repeat', 'copyKeywords' => 0, 'copyRequirements' => 0);
     $my['options'] = array_merge($my['options'], (array) $options);
     $my['mappings'] = array();
     $my['mappings'] = array_merge($my['mappings'], (array) $mappings);
     $copyTCaseOpt = array('copy_also' => array('keyword_assignments' => $my['options']['copyKeywords'], 'requirement_assignments' => $my['options']['copyRequirements']));
     $copyOptions = array('keyword_assignments' => $my['options']['copyKeywords']);
     $tcase_mgr = new testcase($this->db);
     $tsuite_info = $this->get_by_id($id);
     $op = $this->create($parent_id, $tsuite_info['name'], $tsuite_info['details'], $tsuite_info['node_order'], $my['options']['check_duplicate_name'], $my['options']['action_on_duplicate_name']);
     $op['mappings'][$id] = $op['id'];
     $new_tsuite_id = $op['id'];
     // Work on root of these subtree
     // Attachments
     // Keyword assignment
     // Custom Field values
     $this->copy_attachments($id, $new_tsuite_id);
     if ($my['options']['copyKeywords']) {
         $kmap = isset($my['mappings']['keywords']) ? $my['mappings']['keywords'] : null;
         $this->copy_keyword_assignment($id, $new_tsuite_id, $kmap);
     }
     $this->copy_cfields_values($id, $new_tsuite_id);
     $my['filters'] = array('exclude_children_of' => array('testcase' => 'exclude my children'));
     $subtree = $this->tree_manager->get_subtree($id, $my['filters']);
     if (!is_null($subtree)) {
         $parent_decode = array();
         $parent_decode[$id] = $new_tsuite_id;
         foreach ($subtree as $the_key => $elem) {
             $the_parent_id = $parent_decode[$elem['parent_id']];
             switch ($elem['node_type_id']) {
                 case $this->node_types_descr_id['testcase']:
                     $tcOp = $tcase_mgr->copy_to($elem['id'], $the_parent_id, $user_id, $copyTCaseOpt);
                     $op['mappings'] += $tcOp['mappings'];
                     break;
                 case $this->node_types_descr_id['testsuite']:
                     $tsuite_info = $this->get_by_id($elem['id']);
                     $ret = $this->create($the_parent_id, $tsuite_info['name'], $tsuite_info['details'], $tsuite_info['node_order']);
                     $parent_decode[$elem['id']] = $ret['id'];
                     $op['mappings'][$elem['id']] = $ret['id'];
                     $tcase_mgr->copy_attachments($elem['id'], $ret['id']);
                     if ($my['options']['copyKeywords']) {
                         $this->copy_keyword_assignment($elem['id'], $ret['id'], $kmap);
                     }
                     $this->copy_cfields_values($elem['id'], $ret['id']);
                     break;
             }
         }
     }
     return $op;
 }