             try
                 list.path = JSON.parse list.path
             catch error
+                list.path = null
 
         send length: todoLists.length, rows: todoLists
 

        else
            next()

    Tree.getOrCreate createTreeCb, only: ['update', 'destroy', 'create']



### Actions ###

#          Other attributes of a todoList are optionnal (content, tags)
###
action 'create', ->

    parent_id = body.parent_id
    parent_id = "tree-node-all" if not parent_id?
    path = Tree.getPath parent_id
    path.push body.title
    body.path = JSON.stringify path

    TodoList.create body, (err, todoList) ->
        if err
            send error: 'TodoList cannot be created'
        else
            Tree.addNode todoList, parent_id, (err)->
                if err
                    send error: 'Tree cannot be updated'
                else
                    todoList.path = JSON.parse todoList.path
                    send todoList, 201

###
# Update the todoList and tree in case of :
#   change of the title
