How to assign a section to a specific node with Workbench? I'm creating nodes using a custom modules

$node = new stdClass();
$node-&gt;type = $link['content_type'];

node_object_prepare($node);

$node-&gt;uid = $user-&gt;uid;
$node-&gt;name = $user-&gt;name;

$node-&gt;title = $html['title'];
$node-&gt;language = LANGUAGE_NONE;
$node-&gt;body[$node-&gt;language][0]['value'] = $html['html'];
$node-&gt;body[$node-&gt;language][0]['summary'] = $html['summary'];
$node-&gt;body[$node-&gt;language][0]['format'] = 'filtered_html';

$node-&gt;menu['enabled'] = 0; // 1 to enable providing a link in main menu
$node-&gt;menu['link_title'] = urlencode($html['title']);
$node-&gt;menu['description'] = urlencode($html['summary']);
$node-&gt;menu['parent'] = 'main-menu:0';

$node-&gt;menu['weight'] = 5;
$node-&gt;path['alias'] = urlencode($html['title']) . time();
$node-&gt;comment = 1;

$node-&gt;status = 1;        // 1 means published
$node-&gt;promote = 0;
$node-&gt;revision = 0;

$node-&gt;changed = $_SERVER['REQUEST_TIME'];
$node-&gt;created = $_SERVER['REQUEST_TIME'];

node_submit($node);
@node_save($node);

$node-&gt;path['alias'] .= '+' . $node-&gt;nid;

node_submit($node);
@node_save($node);

db_update('node_revision')
    -&gt;fields(array('uid' =&gt; $node-&gt;uid))
    -&gt;condition('vid', $node-&gt;vid)
    -&gt;execute();


But now I need to assign each node a I create a workbench section, so I tried doing this:

$node-&gt;workbench_access = array('66');

node_submit($node);
@node_save($node);

$node-&gt;path['alias'] .= '+' . $node-&gt;nid;

node_submit($node);
@node_save($node);

db_update('node_revision')
    -&gt;fields(array('uid' =&gt; $node-&gt;uid))
    -&gt;condition('vid', $node-&gt;vid)
    -&gt;execute();


This add the workbench access id temporarily, but when the page is refreshed it doesn't apply it. Is there a way to assign a node to a workbench section using php?
You could try an insert query to inject the access ID, node ID and access scheme into the workbench_access_node table.