The reason seems to be with the current code, cat id 1 must have a parent value of `0` and no `null`. Obviously the code needs to be changed because the parent field can only be set with `CategoryEntity` so can not be set to 0 via the code.