public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
SetStatusText("Recalculating CO2e for each elemeBnt...");
var sw = new Stopwatch();
sw.Start();
var collector = new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document);
ICollection<Element> ameeElements = collector.WherePasses(Settings.CreateFilterForElementsWithCO2eParameter()).WhereElementIsNotElementType().ToElements();
var transaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "RecalculateCO2eCommand");
transaction.Start();
Settings.GetCO2eCalculator().UpdateElementCO2eParameters(ameeElements);
transaction.Commit();
sw.Stop();
SetStatusText("Recalculated all COe2 values in {0}", sw.Elapsed);
logger.InfoFormat("Recalculated all COe2 values in {0}", sw.Elapsed);
return Result.Succeeded;
}