How to Add a Product Variant

referance1: http://msdn.microsoft.com/en-us/library/aa546033.aspx
referance2: http://ravikk.spaces.live.com/blog/cns!F348D7145D1BE6C2!411.entry
Quoted from ref1:
private static void AddVariant(
CatalogContext context, string variantId, string catalogName, string productId)
{
// Get the product family from the catalog.
BaseCatalog baseCatalog = (BaseCatalog)context.GetCatalog(catalogName);
ProductFamily productFamily = (ProductFamily)baseCatalog.GetProduct(productId);

// Add the variant to the product family.
productFamily.AddVariant(variantId);

// Set the properties for the variant product.
productFamily.Variants[variantId][“Color”] = “Green”;
}