public bool Contains(MetadataAuthorizedKey key)
 {
     return(this.Keys
            .Any(k => k.Key == key.Key &&
                 k.KeyType == key.KeyType &&
                 k.LoginUsername == key.LoginUsername));
 }
 public MetadataAuthorizedKeySet Add(MetadataAuthorizedKey key)
 {
     if (Contains(key))
     {
         return(this);
     }
     else
     {
         return(new MetadataAuthorizedKeySet(this.Keys.ConcatItem(key)));
     }
 }
        public static MetadataAuthorizedKeySet FromMetadata(Metadata.ItemsData data)
        {
            Utilities.ThrowIfNull(data, nameof(data));
            if (data.Key != MetadataKey)
            {
                throw new ArgumentException("Not a valid metadata key");
            }

            return(new MetadataAuthorizedKeySet(
                       data.Value
                       .Split('\n')
                       .Where(line => !string.IsNullOrWhiteSpace(line))
                       .Select(line => MetadataAuthorizedKey.Parse(line))
                       .ToList()));
        }