Implement Hierarchical Locking System for Tree Structures