function Invite_Main_Collaborators($workroom_id = 0)
 {
     $Item_ID = get_item_id_by_workroom_id($workroom_id);
     //get_post_meta($workroom_id,'Unfinished_Item_ID',true);
     $author_id = get_post_field('post_author', $workroom_id);
     $data = get_list_of_parent_items($Item_ID, array());
     $Alert_Title = 'You have received Invitation From ' . get_the_author_meta('display_name', $author_id) . ' to join in his workroom';
     foreach ($data as $vals) {
         $to_author_id = get_post_field('post_author', $vals);
         //Generate Unique Id
         $Alert_Id = uniqid();
         //End Generate Unique ID
         $InvAlerts = new stdClass();
         $InvAlerts->Collaborator_Name = ' ' . get_the_author_meta('first_name', $to_author_id) . ' ' . get_the_author_meta('last_name', $to_author_id);
         $InvAlerts->Workroom_Name = get_the_title($workroom_id);
         $InvAlerts->Invitation_Accept_Link = $this->Get_Invitation_Accept_Link($workroom_id, $to_author_id, $Alert_Id);
         $InvAlerts->Invitation_Sender = get_the_author_meta('first_name', $author_id) . ' ' . get_the_author_meta('last_name', $author_id);
         ob_start();
         include collaboration_plugin_dir . 'templates/frontend/emails/collaboration-invitation-email-template.php';
         $Get_Template = ob_get_clean();
         ob_start();
         include collaboration_plugin_dir . 'templates/frontend/emails/collaboration-email-css.php';
         $css = ob_get_clean();
         //Add Alert
         $collection = array('Edd_Alert_Message' => $Get_Template, 'Edd_Alert_Title' => $Alert_Title, 'Edd_Alert_Id' => $Alert_Id, 'Edd_Alert_To' => $to_author_id, 'Edd_Alert_From' => $author_id, 'Edd_Alert_Message_Url' => $this->Get_Invitation_Accept_Link($workroom_id, $to_author_id, $Alert_Id, false));
         $this->update_collaborators_invitation($workroom_id, 'Invited', $to_author_id, $Alert_Id);
         edd_add_alerts($collection);
         //End ALert
         wp_mail('*****@*****.**', $Alert_Title, $css . $Get_Template);
         wp_mail(get_the_author_meta('user_email', $to_author_id), $Alert_Title, $css . $Get_Template);
     }
 }
function get_teams_as_workroom($Workroom_Id)
{
    $item_id = get_item_id_by_workroom_id($Workroom_Id);
    $main = get_main_item_id_by_workroom_id($Workroom_Id);
    $all_parents = get_list_of_parent_items($item_id, array($item_id));
    $all_childs = get_list_of_childs($item_id, $all_parents);
    foreach ($all_childs as $records) {
        $author_id = get_post_field('post_author', $records);
        $status = get_post_meta($Workroom_Id, 'Invitation_Status_' . $author_id, true);
        $collects_items[$author_id] = (object) array('Collaborator_Id' => $author_id, 'Invitation_Status' => $status, 'Item_Id' => $records, 'Main_Item_Id' => $main);
    }
    return $collects_items;
}