public void Update(Guid appKey, Guid versionKey)
 {
     var targetAppVersionController = new TargetAppVersions(config);
     VersionCheckResult changeResult = targetAppVersionController.TargetAppVersionChanged(config.TargetKey, appKey, versionKey);
     if (changeResult == VersionCheckResult.Changed)
     {
         System.Guid? updatedVersionKey = targetAppVersionController.GetTargetAppVersion(config.TargetKey, appKey);
         if (updatedVersionKey.HasValue)
             RunUpdate(appKey, updatedVersionKey.Value);
     }
     else if (changeResult == VersionCheckResult.NotSet)
     {
         // Check for latest version
         var versionController = new Versions(config);
         var res = versionController.SearchAppVersions(appKey, pageSize: 1);
         if (res.Versions.Count() != 1)
         {
             throw new AppDeploymentException(string.Format("Failed updating application \"{0}\", no versions found.", appKey));
         }
         if (res.Versions.Single().Key != versionKey)
         {
             RunUpdate(appKey, res.Versions.Single().Key);
         }
     }
 }