public void UpsertPersonalizedPlanAsyncValidate(UserPlan userPlan)
        {
            //arrange
            dynamic        expectedResult;
            Document       updatedDocument = new Document();
            JsonTextReader reader          = new JsonTextReader(new StringReader(ShareTestData.userProfileWithSharedResource));

            updatedDocument.LoadFrom(reader);

            dbService.UpdateItemAsync <UserProfile>(
                Arg.Any <string>(),
                Arg.Any <UserProfile>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            dbService.CreateItemAsync <SharedResources>(
                Arg.Any <SharedResources>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            //act
            var result = personalizedPlanBusinessLogic.UpsertPersonalizedPlanAsync(userPlan).Result;

            expectedResult = null;

            //assert
            Assert.Equal(expectedResult, result);
        }
        public async Task <dynamic> UpsertUserSavedResourcesAsync(ProfileResources userData)
        {
            var userDocument = new ProfileResources();

            userDocument = JsonConvert.DeserializeObject <ProfileResources>(JsonConvert.SerializeObject(userData));
            string  oId    = userDocument.OId;
            dynamic result = null;
            string  type   = userData.Type;
            dynamic userResourcesDBData = null;
            var     userProfile         = await GetUserProfileDataAsync(oId);

            if (userProfile?.SavedResourcesId != null && userProfile?.SavedResourcesId != Guid.Empty)
            {
                userResourcesDBData = await dbClient.FindItemsWhereAsync(dbSettings.UserResourcesCollectionId, Constants.Id, Convert.ToString(userProfile.SavedResourcesId, CultureInfo.InvariantCulture));
            }
            if (userResourcesDBData == null || userResourcesDBData?.Count == 0)
            {
                result = await CreateUserSavedResourcesAsync(userData);

                string savedResourcesId = result.Id;
                userProfile.SavedResourcesId = new Guid(savedResourcesId);
                await dbService.UpdateItemAsync(userProfile.Id, userProfile, dbSettings.ProfilesCollectionId);
            }
            else
            {
                Guid id = Guid.Parse(userResourcesDBData[0].id);
                result = await UpdateUserSavedResourcesAsync(id, userData);
            }
            return(result);
        }
        public void SaveAnswersAsyncValidate(CuratedExperience curatedExperiencedata, dynamic expectedData, Guid answersDocId, CuratedExperienceAnswersViewModel viewModelAnswer, CuratedExperienceAnswers curatedExperienceAnswers, dynamic CuratedExperienceAnswersSchema)
        {
            //arrange
            var dbResponse = dbService.GetItemAsync <CuratedExperienceAnswers>(answersDocId.ToString(), dbSettings.GuidedAssistantAnswersCollectionId);

            dbResponse.ReturnsForAnyArgs <CuratedExperienceAnswers>(curatedExperienceAnswers);

            Document       updatedDocument = new Document();
            JsonTextReader reader          = new JsonTextReader(new StringReader(CuratedExperienceAnswersSchema));

            updatedDocument.LoadFrom(reader);

            dbService.UpdateItemAsync <CuratedExperienceAnswersViewModel>(
                Arg.Any <string>(),
                Arg.Any <CuratedExperienceAnswersViewModel>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            dbService.CreateItemAsync <CuratedExperienceAnswers>(
                Arg.Any <CuratedExperienceAnswers>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            //act
            var response       = curatedExperience.SaveAnswersAsync(viewModelAnswer, curatedExperiencedata);
            var actualResult   = JsonConvert.SerializeObject(response.Result);
            var expectedResult = JsonConvert.SerializeObject(expectedData);

            //assert
            Assert.Equal(expectedResult, actualResult);
        }
        public void ShareResourceDataAsyncShouldReturnResourceUrl(ShareInput shareInput, int permaLinkOutputLength, dynamic expectedResult)
        {
            dynamic profileResponse = userProfileBusinessLogic.GetUserProfileDataAsync(shareInput.UserId).Returns <dynamic>(ShareTestData.UserProfileWithoutSharedResourceData);

            dbShareSettings.PermaLinkMaxLength.Returns(permaLinkOutputLength);

            Document       updatedDocument = new Document();
            JsonTextReader reader          = new JsonTextReader(new StringReader(ShareTestData.userProfileWithSharedResource));

            updatedDocument.LoadFrom(reader);

            dbService.UpdateItemAsync <UserProfile>(
                Arg.Any <string>(),
                Arg.Any <UserProfile>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            dbService.CreateItemAsync <SharedResources>(
                Arg.Any <SharedResources>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            //act
            var result = shareBusinessLogic.ShareResourceDataAsync(shareInput).Result;

            //assert
            Assert.Equal(expectedResult.PermaLink.Length, result.PermaLink.Length);
        }
Example #5
0
        public async Task <Document> ImportCuratedTemplate(JObject guideTemplate, Guid newTemplateId)
        {
            var curatedExprienceJson = a2jAuthorBuisnessLogic.ConvertA2JAuthorToCuratedExperience(guideTemplate, true);

            curatedExprienceJson.A2jPersonalizedPlanId = newTemplateId;

            return(await backendDatabaseService.UpdateItemAsync(curatedExprienceJson.CuratedExperienceId.ToString(),
                                                                JObject.FromObject(curatedExprienceJson), cosmosDbSettings.CuratedExperiencesCollectionId));
        }
        public void UpdateUserSavedResourcesAsyncTestsShouldReturnProperData()
        {
            //arrange
            var userProfileSavedResources = this.userProfileSavedResourcesData;
            var resource       = JsonConvert.SerializeObject(this.userProfileSavedResourcesData.First);
            var userUIDocument = JsonConvert.DeserializeObject <dynamic>(resource);
            var inputJson      = userUIDocument;

            inputJson = JsonConvert.DeserializeObject <ProfileResources>(JsonConvert.SerializeObject(inputJson));
            string        id   = userUIDocument.id;
            string        oId  = userUIDocument.oId;
            string        type = userUIDocument.type;
            List <string> resourcesPropertyNames = new List <string>()
            {
                Constants.OId, Constants.Type
            };
            List <string> resourcesValues = new List <string>()
            {
                oId, type
            };
            Document       document = new Document();
            JsonTextReader reader   = new JsonTextReader(new StringReader(expectedUserProfileSavedResourcesUpdateData[0].ToString()));

            document.LoadFrom(reader);
            dynamic actualResult = null;

            dynamicQueries.FindItemsWhereAsync(cosmosDbSettings.ResourcesCollectionId, resourcesPropertyNames, resourcesValues).ReturnsForAnyArgs(expectedUserProfileSavedResourcesUpdateData);
            backendDatabaseService.UpdateItemAsync <dynamic>(id, document, cosmosDbSettings.ResourcesCollectionId).ReturnsForAnyArgs(document);

            //act
            actualResult = userProfileBusinessLogic.UpdateUserSavedResourcesAsync(Guid.Parse(id), inputJson).Result;

            //assert
            Assert.Equal(expectedUserProfileSavedResourcesUpdateData[0].ToString(), actualResult.ToString());
        }
        public void UpsertStaticNavigationDataAsyncShouldValidate(Navigation navigationInput, JArray navigationDBData, dynamic expectedResult)
        {
            var expectedName = "Navigation";
            var dbResponse   = dynamicQueries.FindItemsWhereWithLocationAsync(cosmosDbSettings.StaticResourcesCollectionId, Constants.Name, navigationInput.Name, new Location());

            dbResponse.ReturnsForAnyArgs(navigationDBData);

            Document       updatedDocument = new Document();
            JsonTextReader reader          = new JsonTextReader(new StringReader(StaticResourceTestData.updatedStaticNavigationContent));

            updatedDocument.LoadFrom(reader);

            backendDatabaseService.CreateItemAsync <dynamic>(
                Arg.Any <Navigation>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            backendDatabaseService.UpdateItemAsync <dynamic>(
                Arg.Any <string>(),
                Arg.Any <Navigation>(),
                Arg.Any <string>()).ReturnsForAnyArgs <Document>(updatedDocument);

            //act
            var response = staticResourceBusinessLogic.UpsertStaticNavigationDataAsync(navigationInput);

            expectedResult = JsonConvert.SerializeObject(expectedResult);
            var actualResult = JsonConvert.SerializeObject(response.Result);

            //assert
            Assert.Contains(expectedName, expectedResult);
        }
        public async Task <object> UpsertSharedResource(UserProfile userProfile, SharedResource sharedResource)
        {
            List <SharedResource> sharedResources = new List <SharedResource>();
            dynamic userSharedResourcesDBData     = null;
            dynamic response = null;

            if (userProfile?.SharedResourceId != null && userProfile.SharedResourceId != Guid.Empty)
            {
                userSharedResourcesDBData = await dbClient.FindItemsWhereAsync(dbSettings.UserResourcesCollectionId, Constants.Id, Convert.ToString(userProfile.SharedResourceId, CultureInfo.InvariantCulture));
            }
            if (userSharedResourcesDBData != null && userSharedResourcesDBData.Count > 0)
            {
                var userSharedResources = new List <SharedResources>();
                userSharedResources = JsonUtilities.DeserializeDynamicObject <List <SharedResources> >(userSharedResourcesDBData);
                userSharedResources[0].SharedResourceId = userProfile.SharedResourceId;
                userSharedResources[0].SharedResource.Add(sharedResource);
                response = await dbService.UpdateItemAsync(userProfile.SharedResourceId.ToString(), userSharedResources[0],
                                                           dbSettings.UserResourcesCollectionId);
            }
            else
            {
                var userSharedResources = new SharedResources();
                if (userSharedResourcesDBData != null)
                {
                    userSharedResources.SharedResourceId = userProfile.SharedResourceId;
                }
                else
                {
                    userSharedResources.SharedResourceId = Guid.NewGuid();
                }
                sharedResources.Add(sharedResource);
                userSharedResources.SharedResource = sharedResources;
                userProfile.SharedResourceId       = userSharedResources.SharedResourceId;
                await dbService.UpdateItemAsync(userProfile.Id, userProfile,
                                                dbSettings.ProfilesCollectionId);

                response = await dbService.CreateItemAsync((userSharedResources), dbSettings.UserResourcesCollectionId);
            }
            return(response);
        }
        public async Task <Document> SaveAnswersAsync(CuratedExperienceAnswersViewModel viewModelAnswer, CuratedExperience curatedExperience)
        {
            var dbAnswers       = MapCuratedExperienceViewModel(viewModelAnswer, curatedExperience);
            var savedAnswersDoc = await dbService.GetItemAsync <CuratedExperienceAnswers>(viewModelAnswer.AnswersDocId.ToString(), dbSettings.GuidedAssistantAnswersCollectionId);

            if (savedAnswersDoc == null || savedAnswersDoc.AnswersDocId == default(Guid))
            {
                return(await dbService.CreateItemAsync(dbAnswers, dbSettings.GuidedAssistantAnswersCollectionId));
            }

            savedAnswersDoc.ButtonComponents.AddRange(dbAnswers.ButtonComponents);
            savedAnswersDoc.FieldComponents.AddRange(dbAnswers.FieldComponents);

            return(await dbService.UpdateItemAsync(viewModelAnswer.AnswersDocId.ToString(), savedAnswersDoc, dbSettings.GuidedAssistantAnswersCollectionId));
        }
        public async Task <Document> UpsertPersonalizedPlanAsync(UserPlan userPlan)
        {
            try
            {
                PersonalizedPlanViewModel personalizedPlan = userPlan.PersonalizedPlan;
                string  oId      = userPlan.UserId;
                dynamic response = null;

                var userPersonalizedPlan = await GetPersonalizedPlanAsync(personalizedPlan.PersonalizedPlanId);

                if (userPersonalizedPlan == null || userPersonalizedPlan?.PersonalizedPlanId == Guid.Empty)
                {
                    var newPlan = await backendDatabaseService.CreateItemAsync(personalizedPlan, cosmosDbSettings.ActionPlansCollectionId);

                    if (!Guid.TryParse(newPlan.Id, out Guid guid))
                    {
                        return(response);
                    }
                    response = newPlan;
                }
                else
                {
                    response = await backendDatabaseService.UpdateItemAsync(
                        personalizedPlan.PersonalizedPlanId.ToString(), personalizedPlan, cosmosDbSettings.ActionPlansCollectionId);
                }
                if (!userPlan.saveActionPlan)
                {
                    await UpdatePlanToProfile(personalizedPlan.PersonalizedPlanId, oId, personalizedPlan);
                }
                return(response);
            }
            catch
            {
                return(null);
            }
        }
Example #11
0
        /// <summary>
        /// upserts service provider
        /// </summary>
        public async Task <IEnumerable <Document> > UpsertServiceProviderDocumentAsync(List <ServiceProvider> serviceProvider, string topic)
        {
            var resources = new List <Document>();
            var serviceProviderObjects = JsonUtilities.DeserializeDynamicObject <List <ServiceProvider> >(serviceProvider);

            foreach (var serviceProviderObject in serviceProviderObjects)
            {
                var serviceProviderLocation = new Location {
                    State = serviceProviderObject.Location[0].State
                };
                if (!string.IsNullOrEmpty(topic))
                {
                    var topicDBData = await dbClient.FindItemsWhereContainsWithLocationAsync(dbSettings.TopicsCollectionId, Constants.Name, topic, serviceProviderLocation).ConfigureAwait(false);

                    serviceProviderObject.TopicTags = topicDBData.Count > 0 ? GetServiceProviderTopicTags(topicDBData[0].id) : null;
                }
                List <string> propertyNames = new List <string>()
                {
                    Constants.ExternalId, Constants.ResourceType
                };
                List <string> values = new List <string>()
                {
                    serviceProviderObject.ExternalId, serviceProviderObject.ResourceType
                };
                var serviceProviderDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values).ConfigureAwait(false);

                if (serviceProviderDBData.Count == 0)
                {
                    var resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(serviceProviderObject);
                    var result           = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId).ConfigureAwait(false);

                    resources.Add(result);
                }
                else
                {
                    serviceProviderObject.ResourceId = serviceProviderDBData[0].id.ToString();
                    var resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(serviceProviderObject);
                    var result           = await dbService.UpdateItemAsync(serviceProviderObject.ResourceId, resourceDocument, dbSettings.ResourcesCollectionId).ConfigureAwait(false);

                    resources.Add(result);
                }
            }

            return(resources);
        }
Example #12
0
 public async Task<dynamic> UpsertStaticHomePageDataAsync(HomeContent homePageContent)
 {
     dynamic result = null;
     var pageDBData = await dbClient.FindItemsWhereWithLocationAsync(dbSettings.StaticResourcesCollectionId, Constants.Name, homePageContent.Name, homePageContent.Location.FirstOrDefault());
     if (pageDBData?.Count > 0)
     {
         string id = pageDBData[0].id;
         homePageContent.Id = id;
         var pageDocument = JsonUtilities.DeserializeDynamicObject<object>(homePageContent);
         result = await dbService.UpdateItemAsync(id, pageDocument, dbSettings.StaticResourcesCollectionId);
     }
     else
     {
         var pageDocument = JsonUtilities.DeserializeDynamicObject<object>(homePageContent);
         result = await dbService.CreateItemAsync(pageDocument, dbSettings.StaticResourcesCollectionId);
     }
     return result;
 }
        public void UpsertServiceProviderAsyncTestsShouldReturnProperData(string topicName, JArray topic, string externalId, JArray serviceProviderResponseData, string serviceProviderId, JArray serviceProviderData, List <ServiceProvider> serviceProvider, dynamic expectedServiceProviderdata)
        {
            //arrange
            dynamic  actualServiceProviderData = null;
            Location location            = new Location();
            var      dbResponseFindTopic = dynamicQueries.FindItemsWhereContainsWithLocationAsync(cosmosDbSettings.TopicsCollectionId, Constants.Name, topicName, location);

            dbResponseFindTopic.ReturnsForAnyArgs(topic);
            List <string> propertyNames = new List <string>()
            {
                Constants.ExternalId, Constants.ResourceType
            };
            List <string> values = new List <string>()
            {
                externalId, Constants.ServiceProviderResourceType
            };
            var dbResponseFindItems = dynamicQueries.FindItemsWhereAsync(cosmosDbSettings.ResourcesCollectionId, propertyNames, values);

            dbResponseFindItems.ReturnsForAnyArgs(serviceProviderResponseData);
            Document       updatedDocument = new Document();
            JsonTextReader reader          = new JsonTextReader(new StringReader(serviceProviderData[0].ToString()));

            updatedDocument.LoadFrom(reader);
            backendDatabaseService.UpdateItemAsync <dynamic>(serviceProviderId, serviceProviderData, cosmosDbSettings.ResourcesCollectionId)
            .ReturnsForAnyArgs <Document>(updatedDocument);
            backendDatabaseService.CreateItemAsync <dynamic>(serviceProviderData, cosmosDbSettings.ResourcesCollectionId)
            .ReturnsForAnyArgs <Document>(updatedDocument);

            //act
            var response = serviceProvidersBusinessLogic.UpsertServiceProviderDocumentAsync(serviceProvider, topicName).Result;

            foreach (var result in response)
            {
                actualServiceProviderData = result;
            }

            //assert
            Assert.Equal(expectedServiceProviderdata[0].ToString(), actualServiceProviderData.ToString());
        }
        public async Task <IEnumerable <object> > UpsertResourceDocumentAsync(dynamic resource)
        {
            List <dynamic>    results            = new List <dynamic>();
            List <dynamic>    resources          = new List <dynamic>();
            var               resourceObjects    = JsonUtilities.DeserializeDynamicObject <List <dynamic> >(resource);
            Form              forms              = new Form();
            ActionPlan        actionPlans        = new ActionPlan();
            Article           articles           = new Article();
            Video             videos             = new Video();
            Organization      organizations      = new Organization();
            AdditionalReading additionalReadings = new AdditionalReading();
            RelatedLink       relatedLinks       = new RelatedLink();

            foreach (var resourceObject in resourceObjects)
            {
                string id           = resourceObject.id;
                string resourceType = resourceObject.resourceType;
                if (resourceObject.resourceType == "Forms")
                {
                    forms = UpsertResourcesForms(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(forms);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Action Plans")
                {
                    actionPlans = UpsertResourcesActionPlans(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(actionPlans);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Articles")
                {
                    articles = UpsertResourcesArticles(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(articles);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Videos")
                {
                    videos = UpsertResourcesVideos(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(videos);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Organizations")
                {
                    organizations = UpsertResourcesOrganizations(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(organizations);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Additional Readings")
                {
                    additionalReadings = UpsertResourcesAdditionalReadings(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(additionalReadings);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }

                else if (resourceObject.resourceType == "Related Links")
                {
                    relatedLinks = UpsertResourcesRelatedLinks(resourceObject);
                    var           resourceDocument = JsonUtilities.DeserializeDynamicObject <object>(relatedLinks);
                    List <string> propertyNames    = new List <string>()
                    {
                        Constants.Id, Constants.ResourceType
                    };
                    List <string> values = new List <string>()
                    {
                        id, resourceType
                    };
                    var resourceDBData = await dbClient.FindItemsWhereAsync(dbSettings.ResourcesCollectionId, propertyNames, values);

                    if (resourceDBData.Count == 0)
                    {
                        var result = await dbService.CreateItemAsync(resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                    else
                    {
                        var result = await dbService.UpdateItemAsync(id, resourceDocument, dbSettings.ResourcesCollectionId);

                        resources.Add(result);
                    }
                }
            }
            return(resources);
        }