public RepositoryItemBase CreateCopy(bool setNewGUID = true) { // Create a copy by serailized and load from the text, it will not copy all atrs only the one which are saved to XML string s = RepositorySerializer.SerializeToString(this); // TODO: fixme not good practice and not safe, add param to handle in function or another solution... RepositoryItemBase duplicatedItem = (RepositoryItemBase)RepositorySerializer.DeserializeFromText(this.GetType(), s, filePath: this.FilePath); //change the GUID of duplicated item if (setNewGUID && duplicatedItem != null) { duplicatedItem.ParentGuid = Guid.Empty; duplicatedItem.ExternalID = string.Empty; duplicatedItem.Guid = Guid.NewGuid(); List <GuidMapper> guidMappingList = new List <GuidMapper>(); //set new GUID also to child items UpdateRepoItemGuids(duplicatedItem, guidMappingList); duplicatedItem = duplicatedItem.GetUpdatedRepoItem(guidMappingList); } return(duplicatedItem); }