Fixes MenuTreeModel and adds the unit test for it

Signed-off-by: Mario Krizmanic <mario.krizmanic@gmail.com>