Moved nested_set_scope to the class level to avoid duplication.