How to create a user with field collections programmatically? This is what I use to create the user:

    $new_user = array(
        'name' =&gt; $form_state['values']['email'],
        'status' =&gt; 1,
        'access' =&gt; REQUEST_TIME,
        'roles' =&gt; array(),
    );

   user_save('', $new_user);


Now I want to add values to the field collection items. 
I have a field collection called field_personal_details and a field collection item called field_firstname, but I have no idea how to access it. Can someone help me get started?
I think following code should give you an idea.

    //Create a field collection entity
    $field_collection_item = entity_create('field_collection_item', array('field_name' =&gt; 'field_personal_details'));
    $field_collection_item-&gt;field_firstname[LANGUAGE_NONE][0]['value'] = "Yassin Tahtah";        
    //$field_collection_item-&gt;field_firstname['und'][0]['value'] = "Yassin Tahtah";
    $field_collection_item-&gt;setHostEntity('user', $user);
    // Save the entity.
    $field_collection_item-&gt;save(TRUE);