public IList <FhirContainedResource> GetContainedResourceDictionary(IFhirResourceR4 fhirResource)
        {
            List <FhirContainedResource> ResultList = new List <FhirContainedResource>();
            Resource Resource = fhirResource.R4;

            if (Resource is DomainResource DomainResource)
            {
                foreach (Resource ContainedResource in DomainResource.Contained)
                {
                    Bug.Common.Enums.ResourceType?ResourceType = IResourceNameToTypeMap.GetResourceType(ContainedResource.ResourceType.GetLiteral());
                    if (ResourceType.HasValue)
                    {
                        ResultList.Add(new FhirContainedResource(this.FhirVersion, ResourceType.Value, ContainedResource.Id)
                        {
                            R4 = ContainedResource
                        });
                    }
                    else
                    {
                        throw new ApplicationException($"Attempt to parse an unknown resource type of {ContainedResource.ResourceType.GetLiteral()} which was contained within a {Resource.ResourceType.GetLiteral()} parent resource of FHIR version {this.FhirVersion.GetCode()}.");
                    }
                }
            }
            return(ResultList);
        }
 private Common.Enums.ResourceType GetResourceTypeFromString(string resourceName)
 {
     Common.Enums.ResourceType?ResourceType = IResourceNameToTypeMap.GetResourceType(resourceName);
     if (ResourceType.HasValue)
     {
         return(ResourceType.Value);
     }
     else
     {
         throw new ApplicationException($"Internal Server Error: The {nameof(resourceName)} property equal to: {resourceName} from a {typeof(Common.Interfaces.IFhirUri).Name} was unable to be converted to a {typeof(Bug.Common.Enums.ResourceType).Name}");
     }
 }