public static void CopyAttributesResource(OM2MResourceEntity entity, OM2MResource resource)
 {
     resource.ResourceType     = (OM2MResourceType)entity.ResourceType;
     resource.ResourceName     = entity.ResourceName;
     resource.ResourceID       = entity.ResourceId;
     resource.ParentID         = entity.ParentId;
     resource.CreationTime     = entity.CreationTime;
     resource.LastModifiedTime = entity.LastModifiedTime;
     resource.Labels           = entity.Labels;
 }
        static void MapChildResourceRef(OM2MResourceEntity entity, IOM2MChildResourceContainer resource)
        {
            foreach (var childEntity in entity.Resources)
            {
                var childRef = new OM2MChildResourceRef();

                childRef.Name  = childEntity.ResourceName;
                childRef.Type  = (OM2MResourceType)childEntity.ResourceType;
                childRef.Value = childEntity.ResourceId;

                resource.ChildResource.Add(childRef);
            }
        }
        // ToDo:
        public static void MapEntityToResourceCommonProcudure(OM2MResourceEntity entity,
                                                              OM2MResource resource,
                                                              OM2MResultContent resultContent)
        {
            if (resultContent.HasAttributes())
            {
                CopyAttributesResource(entity, resource);
            }

            if (resultContent.HasChildResourceReferences())
            {
                var container = resource as IOM2MChildResourceContainer;
                if (container != null)
                {
                    MapChildResourceRef(entity, container);
                }
            }
        }