Moved assertion helpers and create new ones for Reference and Optional.
Add parent reference expansion for Categories.