/// <summary>
 /// Sets the value of the specified meta data item.
 /// Setting value to null or an empty string results in removing the metadata item.
 /// </summary>
 public void SetMetadata(string metadataName, string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         RemoveMetadata(metadataName);
     }
     else
     {
         lock (SyncRoot) {
             if (buildItem != null)
             {
                 buildItem.SetMetadata(metadataName, value);
             }
             else
             {
                 virtualMetadata[metadataName] = value;
             }
         }
     }
 }