- my $created_item = $self->item;
- $self->item(SL::DB::RequirementSpecItem->new(requirement_spec_id => $created_item->requirement_spec_id, parent_id => $created_item->parent_id, item_type => $created_item->item_type));
+ my $created_item = $self->item;
+ my $is_section = $created_item->item_type eq 'section';
+
+ $self->item(SL::DB::RequirementSpecItem->new(
+ requirement_spec_id => $created_item->requirement_spec_id,
+ parent_id => $is_section ? $created_item->id : $created_item->parent_id,
+ item_type => $is_section ? 'function-block' : $created_item->item_type,
+ ));