private void WriteModel(RobotController robot, AlertLog log)
        {
            log?.RaiseAlert("Writing Salamander model to Robot...");
            RobotIDMappingTable idMap = new RobotIDMappingTable();
            bool result = robot.WriteModelToRobot(FilePath, Document.Model, ref idMap, null, log);

            if (result)
            {
                robot.Close();
                log?.RaiseAlert("Robot file written successfully.");
            }
            else
            {
                log?.RaiseAlert("Writing Robot file failed!", Nucleus.Alerts.AlertLevel.Error);
            }
            robot.Release(result);
            idMap.LinkToFile(FilePath);
            Document.IDMappings[FilePath] = idMap;
            idMap.SaveAsCSV(FilePath.AddNameSuffix("_Mapping", ".csv"));
            Result = result;
        }