/// <summary>
        /// Detaches an item from its parent, inside the collection and in the UI.
        /// </summary>
        public void DetachItem(UICodeblock item)
        {
            // Update the codeblock collection
            List <UICodeblock> blocks = new List <UICodeblock>()
            {
                item
            };

            blocks.AddRange(item.GetComponentsInChildren <UICodeblock>().Where(b => b.Type == UICodeblock.UIBlockType.Executable));
            CurrentSystem.Blocks.DetachItemRange(blocks.Select(b => b.Source).ToArray());

            // Update the transform hierarchy
            item.transform.SetParent(_handle);
            item.PositionController.TargetLocalPosition = item.PositionController.LocalPosition;
        }
        /// <summary>
        /// Inserts an item into the codeblock collection, given a previous sibling as a parent. Pass null to set the item as the entry block.
        /// </summary>
        public void InsertItem(UICodeblock item, UICodeblock previousSibling)
        {
            // Check if the previous sibling has a next sibling
            var         nextSiblings = previousSibling.GetComponentsInChildren <UICodeblock>().Where(b => b.Type == UICodeblock.UIBlockType.Executable);
            UICodeblock nextSibling  = nextSiblings.Count() > 1 ? nextSiblings.ElementAt(1) : null;

            // Update the codeblock collection
            List <UICodeblock> blocks = new List <UICodeblock>();

            blocks.AddRange(item.GetComponentsInChildren <UICodeblock>().Where(b => b.Type == UICodeblock.UIBlockType.Executable));
            CurrentSystem.Blocks.InsertItemRange(blocks.Select(b => b.Source).ToArray(), previousSibling.Source);

            // Update the transform hierarchy
            PlaceUnderCodeblock(item, previousSibling);

            // If there is a next sibling, place it after the last child of the new item
            if (nextSibling != null)
            {
                PlaceUnderCodeblock(nextSibling, blocks.Last());
            }
        }