public static List <Guid> GetProfileMockGuids(this CataloguePath path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     if (!path.Any())
     {
         throw new ArgumentException("Items is empty", nameof(path));
     }
     if (!(path.Last() is IProfile))
     {
         throw new ArgumentException($"Path's last element is not an {nameof(IProfile)}", nameof(path));
     }
     return(path.GetProfileMockPath().Select(x => x.Id.Value).ToList());
 }
 public static string GetEntryId(this CataloguePath path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     if (!path.Any())
     {
         throw new ArgumentException("Items is empty", nameof(path));
     }
     if (!(path.Last() is IEntry))
     {
         throw new ArgumentException($"Path's last element is not an {nameof(IEntry)}", nameof(path));
     }
     return(path.GetEntryPath().Select(x => x.Id.RawValue).ToList().CombineLinkedId());
 }
        public static List <Guid> GetGroupGuids(this CataloguePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            var isIndirectChildOfGroup = path.Reverse().Skip(1).TakeWhile(x => !(x is IGroup)).Any(x => x is IEntry);

            return(isIndirectChildOfGroup
                ? new List <Guid>(0)
                : path.Reverse()
                   .SkipWhile(x => !(x is IGroup))
                   .Reverse()
                   .ToList()
                   .GetEntryPath()
                   .Select(x => x.Id.Value)
                   .ToList());
        }
        public static string GetGroupId(this CataloguePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            var isIndirectChildOfGroup = path.Reverse().Skip(1).TakeWhile(x => !(x is IGroup)).Any(x => x is IEntry);

            return(isIndirectChildOfGroup
                ? null
                : path.Reverse()
                   .SkipWhile(x => !(x is IGroup))
                   .Reverse()
                   .ToList()
                   .GetEntryPath()
                   .Select(x => x.Id.RawValue)
                   .ToList()
                   .CombineLinkedId());
        }