/// <summary>
        /// Creates a copy of a <see cref="AnalyticPriceListGroup"/>.
        /// </summary>
        public static AnalyticPriceListGroup Copy(this AnalyticPriceListGroup source)
        {
            var copy = new AnalyticPriceListGroup();

            copy.Key   = source.Key;
            copy.Name  = source.Name;
            copy.Title = source.Title;
            copy.Sort  = source.Sort;

            foreach (PriceList priceList in source.PriceLists)
            {
                PriceList priceListCopy = priceList.Copy();
                copy.PriceLists.Add(priceListCopy);
            }

            return(copy);
        }
        /// <summary>
        /// Creates a deep copy of an <see cref="Analytic"/>.
        /// </summary>
        public static Analytic Copy(this Analytic source)
        {
            var copy = new Analytic();

            copy.SearchGroupKey = source.SearchGroupKey;

            DateTime createdDate = DateTime.Now;

            copy.Identity.Created   = createdDate;
            copy.Identity.Edited    = createdDate;
            copy.Identity.Refreshed = createdDate;
            copy.Identity.IsActive  = source.Identity.IsActive;
            copy.Identity.Author    = source.Identity.Author;

            string copySuffix = " (Copy)";

            copy.Identity.Description = source.Identity.Description + copySuffix;
            copy.Identity.Editor      = source.Identity.Editor;
            copy.Identity.Name        = source.Identity.Name + copySuffix;
            copy.Identity.Notes       = source.Identity.Notes + copySuffix;
            copy.Identity.Owner       = source.Identity.Owner;
            copy.Identity.Shared      = source.Identity.Shared;

            foreach (FilterGroup filterGroup in source.FilterGroups)
            {
                FilterGroup filterGroupCopy = filterGroup.Copy();
                copy.FilterGroups.Add(filterGroupCopy);
            }

            foreach (AnalyticValueDriver driver in source.ValueDrivers)
            {
                AnalyticValueDriver driverCopy = driver.Copy();
                copy.ValueDrivers.Add(driverCopy);
            }

            foreach (AnalyticPriceListGroup item in source.PriceListGroups)
            {
                AnalyticPriceListGroup priceListGroupCopy = item.Copy();
                copy.PriceListGroups.Add(priceListGroupCopy);
            }

            copy.IsDirty = true;

            return(copy);
        }
        private static List <AnalyticPriceListGroup> GetAnalyticPriceListGroups()
        {
            var result = new List <AnalyticPriceListGroup>();

            string[] grouoNames = { "Regular" };

            for (int groupIndex = 0; groupIndex < grouoNames.Length; groupIndex++)
            {
                string name = grouoNames[groupIndex];
                AnalyticPriceListGroup group = new AnalyticPriceListGroup {
                    Name = name, Sort = (short)groupIndex, Title = name + " title"
                };
                List <PriceList> priceLists = GetPriceLists(groupIndex);
                group.PriceLists = new ReactiveList <PriceList>(priceLists);

                result.Add(group);
            }

            return(result);
        }