Best way to programmatically create categories? We're working on an XML import plugin to migrate content from another CMS.

What's the best way to create a new category (with a name, slug etc.) and assign it to the entry when running 
$entryModel = new EntryModel(); ?
To create a category, you'd have to use the craft()-&gt;categories-&gt;saveCategory() method, and feed it a CategoryModel. Having done that, you can use the ID of your new category to create an array for the entry's category field (in this example its handle is categoryFieldHandle):

$category = new CategoryModel();
$category-&gt;groupId = 2; // Or whatever ID your new category's group has.
$category-&gt;getContent()-&gt;title = 'My new category title'; // Slug will be automagically created

if(craft()-&gt;categories-&gt;saveCategory($category)) {
    $entryModel = new EntryModel();
    $entryModel-&gt;title = 'My entry's title';
    $entryModel-&gt;categoryFieldHandle[] = $category-&gt;id;

    if(craft()-&gt;entries-&gt;saveEntry($entryModel)) {
        ...
    }
}