/// <summary>
        /// Create a new ISharingServiceTarget from a given Azure Remote Rendering Entity object that is child of the
        /// given SharingTargetRoot.
        /// </summary>
        public static ISharingServiceTarget CreateTarget(SharingTargetRoot root, Entity child)
        {
            if (root == null || child == null || !child.Valid)
            {
                return(null);
            }

            RemoteEntitySyncObject rootEntitySync = root.GetComponentInChildren <RemoteEntitySyncObject>();

            if (rootEntitySync == null || !rootEntitySync.IsEntityValid)
            {
                return(null);
            }

            return(root.InnerTarget.AddChild(CreateAddress(rootEntitySync.Entity, child)));
        }
        /// <summary>
        /// Resolve an ISharingServiceTarget to an Azure Remote Rendering Entity object. This will search the 'root' for the remote Entity.
        /// </summary>
        private static Entity FindEntity(SharingTargetRoot root, ISharingServiceTarget target)
        {
            RemoteEntitySyncObject rootEntitySync = root?.GetComponentInChildren <RemoteEntitySyncObject>();

            if (rootEntitySync == null || !rootEntitySync.IsEntityValid)
            {
                Debug.LogError($"Can't find sharing target off of '{root?.name ?? "NULL"}'. Can't find a valid root RemoteEntitySyncObject.");
                return(null);
            }

            Entity parentEntity = rootEntitySync.Entity;
            Entity resultEntity = parentEntity;

            int[] childIndices      = target.Address;
            int   childIndicesCount = childIndices?.Length ?? 0;

            for (int i = 0; i < childIndicesCount; i++)
            {
                if (parentEntity == null)
                {
                    Debug.LogError($"Can't find sharing target off of '{root.name}'. The hierarchy was too shallow.");
                    resultEntity = null;
                    break;
                }

                int index = childIndices[i];
                if (parentEntity.Children.Count <= index)
                {
                    Debug.LogError($"Can't find sharing target off of '{root.name}'. The a parent didn't have enough children. Was excepted a child at index '{index}'");
                    resultEntity = null;
                    break;
                }

                resultEntity = parentEntity.Children[index];
                parentEntity = resultEntity;
            }

            return(resultEntity);
        }