Check category as unassigned(project category) using server API

Hi All,
I want to check in precondition that work item's category is unassigned (root category) then show error message to select different category.
ICategoryHandle category = workItem.getCategory();
if(category == null ){
reporterror()
}
As unassigned is root category its not going in side if condition. Is there way to check its unassigned(root category)
Thanks,
Kavita