public static void SetProperty(DirectoryEntry oDE, string PropertyName, string PropertyValue)
{
    if ((PropertyValue != string.Empty) && (PropertyValue != null))
    {
        if (oDE.Properties.Contains(PropertyName))
        {
            oDE.Properties[PropertyName][0] = PropertyValue;
        }
        else
        {
            oDE.Properties[PropertyName].Add(PropertyValue);
        }
    }
    else
    {
        if (oDE.Properties.Contains(PropertyName))
        {
            oDE.Properties[PropertyName].Clear();
        }
    }
}