public void Update(int attributeId, Guid invocationId, DateTime time, long usn)
 {
     var existingEntry = this.InnerList.FirstOrDefault(item => item.AttributeId == attributeId);
     if(existingEntry != null)
     {
         // This attribute is already contained in the list, so we just update it
         existingEntry.Update(invocationId, time, usn);
     }
     else
     {
         // This is a newly added attribute
         var newEntry = new AttributeMetadata(attributeId, invocationId, time, usn);
         this.InnerList.Add(newEntry);
     }
 }
        public AttributeMetadataCollection(byte[] buffer)
        {
            if(buffer == null)
            {
                this.Unknown = 1;
                this.InnerList = new List<AttributeMetadata>();
                return;
            }
            if(buffer.Length < 2 * sizeof(long))
            {
                throw new ArgumentOutOfRangeException("buffer");
            }

            using(Stream stream = new MemoryStream(buffer))
            {
                using(BinaryReader reader = new BinaryReader(stream))
                {
                    this.Unknown = reader.ReadInt64();
                    long numEntries = reader.ReadInt64();
                    long expectedBufferSize = CalculateBinarySize(numEntries);
                    Validator.AssertLength(buffer, expectedBufferSize, "buffer");
                    this.InnerList = new List<AttributeMetadata>((int) numEntries);
                    for(int i = 1; i <= numEntries; i++)
                    {
                        int attributeId = reader.ReadInt32();
                        int version = reader.ReadInt32();
                        long timestamp = reader.ReadInt64();
                        Guid originatingDSA = new Guid(reader.ReadBytes(16));
                        long originatingUSN = reader.ReadInt64();
                        long localUSN = reader.ReadInt64();
                        var entry = new AttributeMetadata(attributeId, version, timestamp, originatingDSA, originatingUSN, localUSN);
                        this.InnerList.Add(entry);
                    }
                }
            }
        }