private bool LinkPackagesToAutomationSequences(List <AutomationSequence> sequencesToRun)
        {
            UpdateDatabasePackageList();
            foreach (AutomationSequence automationSequence in sequencesToRun)
            {
                automationSequence.DatabasePackages = DatabasePackages;
                Logging.Debug("Linking sequence to package reference: {0}, {1}", automationSequence.PackageName, automationSequence.PackageUID);

                DatabasePackage result = DatabasePackages.Find(pack => pack.UID.Equals(automationSequence.PackageUID));
                if (result == null)
                {
                    Logging.Error("A package does not exist in the database matching UID {0}", automationSequence.PackageUID);
                    return(false);
                }

                if (result.PackageName != automationSequence.PackageName)
                {
                    Logging.Warning(Logfiles.AutomationRunner, "The packageName property is out of date. From database: {0}. From Package: {1}", result.PackageName, automationSequence.PackageName);
                }

                automationSequence.Package = result;
            }

            return(true);
        }
        public void UpdateCurrentDatabasePackage()
        {
            string oldPackageUID = Package.UID;

            Package = DatabasePackages.Find(pack => pack.UID.Equals(oldPackageUID));
            if (Package == null)
            {
                throw new BadMemeException("If you're reading this, then it's too late.");
            }
        }
 protected virtual void PreProcessTargetPackage()
 {
     //check that the target package exists
     if (TargetPackageUID.Equals("this"))
     {
         targetPackage = DatabasePackage;
     }
     else
     {
         targetPackage = DatabasePackages.Find(package => package.UID.Equals(TargetPackageUID));
     }
 }