public function build(array $data)
    {
        $relations = array(
            self::TREE_PARAM_ITEMS => array(),
            self::TREE_PARAM_PARENTS => array()
        );

        foreach ($data as $row) {
            $relations[self::TREE_PARAM_ITEMS][$row[self::TREE_PARAM_ID]] = $row;
            $relations[self::TREE_PARAM_PARENTS][$row[self::TREE_PARAM_PARENT_ID]][] = $row[self::TREE_PARAM_ID];
        }

        return $relations;
    }