public void InsertOrUpdateResourceSecurityInformation(string cluster, Common.Security.Interfaces.IResourceItem resourceItem) { lock (_store) { IDocumentsWriteOperation insertOperation = new InsertDocumentsOperation(); //JsonSerializer<IResourceItem> serializer = new JsonSerializer<IResourceItem>(); IList <IJSONDocument> jsonDocuments = new List <IJSONDocument>(); JSONDocument jdoc = new JSONDocument(); bool found = false; if (resourceItem != null) { //jdoc.Key = new DocumentKey(configuration.Name); found = FindDocument(resourceItem.ResourceId.Name, Alachisoft.NosDB.Core.Util.MiscUtil.SystemCollection.SecurityInformationCollection, out jdoc); if (found) { jdoc = JsonSerializer.Serialize <IResourceItem>(resourceItem); jdoc.Key = resourceItem.ResourceId.Name; IDocumentsWriteOperation replaceOperation = new ReplaceDocumentsOperation(); replaceOperation.Collection = Alachisoft.NosDB.Core.Util.MiscUtil.SystemCollection.SecurityInformationCollection; replaceOperation.Database = MiscUtil.SYSTEM_DATABASE; jsonDocuments.Add(jdoc); replaceOperation.Documents = jsonDocuments; _store.ReplaceDocuments(replaceOperation); //TODO for updating document only deleting previous document require some time to wait In Future this operation done with replace operation. } else { jsonDocuments.Clear(); jdoc = JsonSerializer.Serialize <IResourceItem>(resourceItem); jdoc.Key = resourceItem.ResourceId.Name; jsonDocuments.Add(jdoc); insertOperation.Documents = jsonDocuments; insertOperation.Collection = Alachisoft.NosDB.Core.Util.MiscUtil.SystemCollection.SecurityInformationCollection; insertOperation.Database = MiscUtil.SYSTEM_DATABASE; _store.InsertDocuments(insertOperation); } } } }