Make treeview with checkboxes work properly!

Some changes:

* Fix issue with treeview auto expansion when
level-3-or-deeper items was previously selected

* Add checked checkboxes generation to the treeview
checkbox template

* Refactor entities creation method