public ProductReplaceGroupDTO ToDTO() { var dto = new ProductReplaceGroupDTO(); dto.Id = Id; dto.Name = Name; dto.Description = Description; dto.CategoryId = CategoryId; dto.OrganizationId = OrganizationId; dto.Creator = Creator; dto.Modifier = Modifier; dto.CreatedTime = CreatedTime; dto.ModifiedTime = ModifiedTime; dto.CreatorName = CreatorName; dto.ModifierName = ModifierName; dto.CategoryId = CategoryId; dto.CategoryName = CategoryName; dto.DefaultItemId = DefaultItemId; dto.GroupItemIds = GroupItemIds; dto.Icon = IconFileAssetUrl; dto.IconAssetId = Icon; if (DefaultItem != null) { dto.DefaultItem = DefaultItem.ToDTO(); } if (GroupItems != null && GroupItems.Count > 0) { dto.GroupItems = GroupItems.Select(x => x.ToDTO()).ToList(); } return(dto); }