There is a "Parent Section" (virtual field:
CategoryId) on each category item adding/editing page.
This field allows to place category item into a specific category. This functionality works like a charm, but problem happens, when you need to set another field's value based on the category, where category item is added.
Usually method OnBeforeItemCreate is used for this kind of operation. Strange, but this CategoryId field has no value in this method, however it's clearly is specified on category item creation screen.