public bool ImportV3(string payload, string envelopeIdentifier, SaveStatus status) { InputEntityV3 input = new InputEntityV3(); var bnodes = new List <BNodeV3>(); var mainEntity = new Dictionary <string, object>(); //status.AddWarning( "The resource uses @graph and is not handled yet" ); Dictionary <string, object> dictionary = RegistryServices.JsonToDictionary(payload); object graph = dictionary["@graph"]; //serialize the graph object var glist = JsonConvert.SerializeObject(graph); //parse graph in to list of objects JArray graphList = JArray.Parse(glist); int cntr = 0; foreach (var item in graphList) { cntr++; if (cntr == 1) { var main = item.ToString(); //may not use this. Could add a trace method mainEntity = RegistryServices.JsonToDictionary(main); input = JsonConvert.DeserializeObject <InputEntityV3>(main); } else { var bn = item.ToString(); bnodes.Add(JsonConvert.DeserializeObject <BNodeV3>(bn)); } } List <string> messages = new List <string>(); bool importSuccessfull = false; EntityServices mgr = new EntityServices(); MappingHelperV3 helper = new MappingHelperV3(); helper.entityBlankNodes = bnodes; string ctid = input.Ctid; string referencedAtId = input.CtdlId; LoggingHelper.DoTrace(5, " name: "+ input.Name.ToString()); LoggingHelper.DoTrace(6, " url: "+ input.CostDetails); LoggingHelper.DoTrace(5, " ctid: "+ input.Ctid); LoggingHelper.DoTrace(5, " @Id: "+ input.CtdlId); status.Ctid = ctid; if (status.DoingDownloadOnly) { return(true); } if (!DoesEntityExist(input.Ctid, ref output)) { output.RowId = Guid.NewGuid(); } helper.currentBaseObject = output; output.Name = helper.HandleLanguageMap(input.Name, output, "Name"); output.Description = helper.HandleLanguageMap(input.Description, output, "Description"); output.CTID = input.Ctid; output.CredentialRegistryId = envelopeIdentifier; output.CostDetails = input.CostDetails; output.OwningAgentUid = helper.MapOrganizationReferencesGuid("CostManifest.OwningAgentUid", input.CostManifestOf, ref status); output.StartDate = helper.MapDate(input.StartDate, "StartDate", ref status); output.EndDate = helper.MapDate(input.EndDate, "StartDate", ref status); output.EstimatedCosts = helper.FormatCosts(input.EstimatedCost, ref status); status.DocumentId = output.Id; status.DocumentRowId = output.RowId; //=== if any messages were encountered treat as warnings for now if (messages.Count > 0) { status.SetMessages(messages, true); } importSuccessfull = mgr.Import(output, ref status); //just in case if (status.HasErrors) { importSuccessfull = false; } //if record was added to db, add to/or set EntityResolution as resolved int ierId = new ImportManager().Import_EntityResolutionAdd(referencedAtId, ctid, CodesManager.ENTITY_TYPE_COST_MANIFEST, output.RowId, output.Id, false, ref messages, output.Id > 0); return(importSuccessfull); }