Create nested Category via PHP
Assuming $parentCategory is an existing CategoryModel (your error says that $parentCategory is not an object):

$childCategory = new CategoryModel();
$childCategory-&gt;groupId = 1;
$childCategory-&gt;newParentId = $parentCategory-&gt;id;
$childCategory-&gt;getContent()-&gt;title = $childCategoryName;

craft()-&gt;categories-&gt;saveCategory($childCategory);


You can see how Craft does it for it's own categories in CategoriesController->saveCategory() and CategoriesService->saveCategory().