private void AddVehicleXmlFile(string xmlFilePath)
        {
            var luaScripts = ScriptExtractHelper.ExtractScriptsFromMicrocontrollerXml(xmlFilePath);

            foreach (var script in luaScripts)
            {
                _luaScripts.Add(script);
                _xmlToLocalLuaWriteService.WriteVehicleLuaScriptToFile(script);
            }
        }
        private void VehicleChanged(string xmlfilepath)
        {
            if (xmlfilepath == _ignoreNextVehicleUpdatePath)
            {
                _ignoreNextVehicleUpdatePath = null;
                return;
            }

            var savedVehicleScripts = ScriptExtractHelper.ExtractScriptsFromMicrocontrollerXml(xmlfilepath).ToList();

            var previouslyExtractedScripts = _luaScripts.Where(ls => ls.VehicleXmlPath == xmlfilepath).ToList();
            var newScripts     = savedVehicleScripts.Where(vs => previouslyExtractedScripts.All(nvs => nvs.ObjectId != vs.ObjectId));
            var deletedScripts = previouslyExtractedScripts.Where(vs => savedVehicleScripts.All(nvs => nvs.ObjectId != vs.ObjectId)).ToList();

            foreach (var newScript in newScripts)
            {
                _luaScripts.Add(newScript);
                _ignoreNextLuaUpdatePaths.Add(newScript.LuaFilePath);
                _xmlToLocalLuaWriteService.WriteVehicleLuaScriptToFile(newScript);
            }

            foreach (var deletedScript in deletedScripts)
            {
                _luaScripts.Remove(deletedScript);
                var deletedScriptContent = FileHelper.NoTouchReadFile(deletedScript.LuaFilePath);
                if (!BackupFileHelper.BackupFile(deletedScriptContent, deletedScript.LuaFileName))
                {
                    continue;
                }

                File.Delete(deletedScript.LuaFilePath);
                File.Delete(deletedScript.MinifiedLuaPath);
            }

            foreach (var existingScript in previouslyExtractedScripts.Except(deletedScripts))
            {
                _ignoreNextLuaUpdatePaths.Add(existingScript.LuaFilePath);
                if (!_xmlToLocalLuaWriteService.WriteVehicleLuaScriptToFile(existingScript))
                {
                    _ignoreNextLuaUpdatePaths.Remove(existingScript.LuaFilePath);
                }
            }
        }