public void swapElement(Integer firstId, Integer secondId) {
        ElementInfo firstInfo = elementMap.get(firstId);
        ElementInfo secondInfo = elementMap.get(secondId);
        if (firstInfo != null && secondInfo != null) {
            //swap ids at Depth Manager.
            depthManager.getDepth(firstInfo.depth).getNodeElement(firstInfo.indexAtRow).setElementId(secondId);
            depthManager.getDepth(secondInfo.depth).getNodeElement(secondInfo.indexAtRow).setElementId(firstId);

            ElementInfo temp = new ElementInfo(null, firstInfo.getDepth(), firstInfo.getIndexAtRow(), firstInfo.getIdParent());

            setChildrenNewParent(firstInfo, secondId);
            setChildrenNewParent(secondInfo, firstId);

            //swap elements info
            firstInfo.depth = secondInfo.getDepth();
            firstInfo.indexAtRow = secondInfo.getIndexAtRow();

            secondInfo.depth = temp.getDepth();
            secondInfo.indexAtRow = temp.getIndexAtRow();

            if (firstInfo.idParent != secondId) {
                firstInfo.idParent = secondInfo.getIdParent();
            }

            if (temp.getIdParent() != firstId) {
                secondInfo.idParent = temp.getIdParent();
            }

        }
    }