/** Method extracts data from publish settings file. */
 public static PublishData handlePublishSettings(File file, Project project) {
   PublishData data = UIUtils.createPublishDataObj(file);
   /*
    * If data is equal to null,
    * then publish settings file already exists.
    * So don't load information again.
    */
   if (data != null) {
     AccountActionRunnable settings =
         new CacheAccountWithProgressBar(file, data, message("loadingCred"));
     ProgressManager.getInstance()
         .runProcessWithProgressSynchronously(
             settings, "Loading Account Settings...", true, project);
     AzureSettings.getSafeInstance(project).savePublishDatas();
   }
   return data;
 }
 /** Method prepares storage account list. Adds data from publish settings file. */
 public static void prepareListFromPublishData(Project project) {
   List<StorageAccount> strgList = StorageAccountRegistry.getStrgList();
   Collection<PublishData> publishDatas = WizardCacheManager.getPublishDatas();
   for (PublishData pd : publishDatas) {
     for (Subscription sub : pd.getPublishProfile().getSubscriptions()) {
       /*
        * Get collection of storage services in each subscription.
        */
       StorageServices services = pd.getStoragesPerSubscription().get(sub.getId());
       // iterate over collection of services.
       for (StorageService strgService : services) {
         StorageAccount strEle =
             new StorageAccount(
                 strgService.getServiceName(),
                 strgService.getPrimaryKey(),
                 strgService.getStorageAccountProperties().getEndpoints().get(0).toString());
         /*
          * Check if storage account is already present
          * in centralized repository,
          * if present then do not add.
          * if not present then check
          * access key is valid or not.
          * If not then update with correct one in registry.
          */
         if (strgList.contains(strEle)) {
           int index = strgList.indexOf(strEle);
           StorageAccount account = strgList.get(index);
           String newKey = strEle.getStrgKey();
           if (!account.getStrgKey().equals(newKey)) {
             account.setStrgKey(newKey);
           }
         } else {
           strgList.add(strEle);
         }
       }
     }
   }
   AzureSettings.getSafeInstance(project).saveStorage();
 }