public async Task MigrateToCloudIA(List <MapMigrationItemViewModel> mapItems, IntegrationAccountDetails iaDetails)
        {
            this.iaDetails = iaDetails;
            ActionsOnMaps        action                     = new ActionsOnMaps();
            var                  mapsToBeUploaded           = thisApplicationContext.GetProperty("MapsToUploadOrder") as List <MapDetails>;
            AuthenticationResult authresult                 = thisApplicationContext.GetProperty("IntegrationAccountAuthorization") as AuthenticationResult;
            bool                 overwriteExistingArtifacts = Convert.ToBoolean(thisApplicationContext.GetProperty("OverwriteEnabled"));
            List <MapDetails>    mapDetailsList             = new List <MapDetails>();

            foreach (var mapItem in mapItems)
            {
                mapItem.MigrationEntity.mapUploadToIAStatus      = MapUploadToIAStatus.NotYetStarted;
                mapItem.MigrationEntity.errorDetailsForMigration = "";
                mapDetailsList.Add(mapItem.MigrationEntity);
            }
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    action.UploadToIntegrationAccount(mapsToBeUploaded, ref mapDetailsList, Resources.JsonMapFilesLocalPath, overwriteExistingArtifacts, iaDetails.SubscriptionId, iaDetails.ResourceGroupName, iaDetails.IntegrationAccountName, authresult);
                    SetMigrationStatus(mapDetailsList, mapItems);
                }
                catch (Exception ex)
                {
                    SetMigrationStatus(mapDetailsList, mapItems);
                    TraceProvider.WriteLine(string.Format("Maps Migration Failed. Reason:{0}", ExceptionHelper.GetExceptionMessage(ex)));
                    TraceProvider.WriteLine();
                    throw new Exception(string.Format("Maps Migration Failed. Reason:{0}", ExceptionHelper.GetExceptionMessage(ex)));
                }
            });
        }
        protected override Task <IEnumerable <MapDetails> > GetEntitiesAsync()
        {
            return(Task.Factory.StartNew <IEnumerable <MapDetails> >(() =>
            {
                try
                {
                    var appDetails = ApplicationContext.GetProperty("SelectedApps") as ObservableCollection <ApplicationDetails>;
                    string parameter = "";
                    foreach (var item in appDetails)
                    {
                        if (item.isSelected)
                        {
                            parameter += "'" + item.nID + "',";
                        }
                    }
                    parameter = parameter.Remove(parameter.Length - 1);

                    var maps = this.ApplicationContext.GetProperty(AppConstants.AllMapsContextPropertyName) as ObservableCollection <MapSelectionItemViewModel>;
                    List <MapDetails> mapsList = new List <MapDetails>();
                    if (maps != null && maps.Count != 0)
                    {
                        foreach (var mapItem in maps)
                        {
                            mapsList.Add(mapItem.MigrationEntity);
                        }
                        return mapsList;
                    }
                    else
                    {
                        ActionsOnMaps action = new ActionsOnMaps();
                        string connectionString = this.ApplicationContext.GetProperty("DatabaseConnectionString") as string;
                        mapsList = action.GetListOfMaps(connectionString, Resources.JsonMapFilesLocalPath, parameter);
                        this.ApplicationContext.SetProperty(AppConstants.MapNamespaceVersionList, action.mapNamespaceVersionDict);
                        return mapsList;
                    }
                }

                catch (Exception ex)
                {
                    TraceProvider.WriteLine(string.Format(CultureInfo.InvariantCulture, "Not able to retrieve maps. {0}", ExceptionHelper.GetExceptionMessage(ex)));
                    var statusBarViewModel = this.ApplicationContext.GetService <StatusBarViewModel>();
                    statusBarViewModel.StatusInfoType = StatusInfoType.Error;
                    statusBarViewModel.ShowError("Error. Failed to retrieve maps from Biztalk Server. Reason: " + ExceptionHelper.GetExceptionMessage(ex));
                    return new List <MapDetails>();
                }
            }));
        }
        //public JsonSchema.RootObject CreateSchemas(SchemaMigrationItemViewModel schemaItem)
        //{
        //    var schema = schemaItem.MigrationEntity;
        //    string schemaName = schema.fullNameOfSchemaToUpload;
        //    JsonSchema.RootObject schemaRootObject = new JsonSchema.RootObject();
        //    try
        //    {
        //        string directroyPathForJsonFiles = Resources.JsonSchemaFilesLocalPath;
        //        string fileName = string.Format(directroyPathForJsonFiles, FileOperations.GetFileName(schemaName), ".json");
        //        string schemaJsonFileContent = Newtonsoft.Json.JsonConvert.SerializeObject(schemaRootObject);
        //        FileOperations.CreateFolder(fileName);
        //        System.IO.File.WriteAllText(fileName, schemaJsonFileContent);
        //        return schemaRootObject;
        //    }
        //    catch (Exception ex)
        //    {
        //        schemaItem.ImportStatus = MigrationStatus.Failed;
        //        schemaItem.ImportStatusText = ex.Message;
        //        TraceProvider.WriteLine(string.Format("Schema Export to Json Failed:{0}", ExceptionHelper.GetExceptionMessage(ex)));
        //        TraceProvider.WriteLine();
        //        throw ex;
        //    }
        //}

        public async Task CreateSchemas(List <MapMigrationItemViewModel> mapItems)
        {
            ActionsOnMaps     action         = new ActionsOnMaps();
            List <MapDetails> mapDetailsList = new List <MapDetails>();
            List <MapDetails> response       = new List <MapDetails>();
            ObservableCollection <MapSelectionItemViewModel> originalCollection = this.thisApplicationContext.GetProperty(AppConstants.AllMapsContextPropertyName) as ObservableCollection <MapSelectionItemViewModel>;
            List <MapSelectionItemViewModel> orignalList = originalCollection.ToList();
            List <MapDetails> originalMapDetailsList     = new List <MapDetails>();

            foreach (var mapItem in mapItems)
            {
                mapItem.MigrationEntity.isMapExtractedFromDb      = false;
                mapItem.MigrationEntity.errorDetailsForExtraction = "";
                mapDetailsList.Add(mapItem.MigrationEntity);
            }
            foreach (var mapItem in orignalList)
            {
                originalMapDetailsList.Add(mapItem.MigrationEntity);
            }
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    response = action.ExtractMapsFromDlls(ref mapDetailsList, Resources.JsonMapFilesLocalPath, originalMapDetailsList);
                    thisApplicationContext.SetProperty("MapsToUploadOrder", response);
                    SetExtractionStatus(mapDetailsList, mapItems);
                }
                catch (Exception ex)
                {
                    SetExtractionStatus(mapDetailsList, mapItems);
                    TraceProvider.WriteLine(string.Format("Maps Extraction Failed:{0}", ExceptionHelper.GetExceptionMessage(ex)));
                    TraceProvider.WriteLine();
                    throw new Exception(string.Format("Maps Extraction Failed. Reason:{0}", ExceptionHelper.GetExceptionMessage(ex)));
                }
            });
        }