private void ChangeIndex(GameObject gameObject, GameObject target, int increment = 0)
        {
            var collection = target?.Parent?.Children ?? SceneData.GameObjects;

            if (!collection.Contains(gameObject))
            {
                MoveTo(gameObject, target?.Parent);
                ChangeIndex(gameObject, target, increment);
                return;
            }

            var oldIndex = Math.Max(collection.IndexOf(gameObject), 0);
            var newIndex = Math.Min(collection.IndexOf(target) + increment, collection.Count);

            if (newIndex > oldIndex)
                newIndex--;

            collection.Move(oldIndex, newIndex);
        }
 public void Drag()
 {
     (Parent?.Children ?? SceneData.GameObjects).Remove(this);
     Parent = null;
 }
 private void MoveTo(GameObject gameObject, GameObject target)
 {
     (gameObject.Parent?.Children ?? SceneData.GameObjects).Remove(gameObject);
     gameObject.Parent = target;
     (target?.Children ?? SceneData.GameObjects).Add(gameObject);
 }