/// <summary>
        /// Populates properties on the view model from an instance of the
        /// HypervisorGroup class.
        /// </summary>
        /// <param name="model">The HypervisorGroup to reference.</param>
        private void ReadEntityProperties(HypervisorGroup model)
        {
            // Properties from the entity.
            this.CreatedDate  = model.CreatedDate;
            this.LastUpdated  = model.LastUpdated;
            this.InactiveDate = model.InactiveDate;
            this.HighAvailabilityCalculationType     = model.HighAvailabilityCalculationType;
            this.HighAvailabilityReservedHypervisors = model.HighAvailabilityReservedHypervisors;
            this.HighAvailabilityReservedPercentage  = model.HighAvailabilityReservedPercentage;

            // IHasCapacity Members.
            this.TotalCapacity       = model.TotalCapacity;
            this.UsedCapacity        = model.UsedCapacity;
            this.UsedCapacityPercent = model.UsedCapacityPercent;

            // Calculated properties.
            this.ComputeCapacity = model.ComputeCapacity;
            this.MemoryCapacity  = model.MemoryCapacity;
            this.StorageCapacity = model.StorageCapacity;
            this.MaximumCapacity = model.MaximumCapacity;

            // Related entities.
            this.HypervisorGroupType = model.HypervisorGroupType;
            this.CapacityRules       = CapacityRuleListCalculationViewModel.SelectMany(model.CapacityRulesMetas, model);

            // Notes and Tags.
            this.Notes = model.Notes
                         .OrderByDescending(x => x.CreatedAt)
                         .AsEnumerable()
                         .Select(x => new NoteDetailsViewModel(x))
                         .ToList();

            this.Tags = model.TagsMetas
                        .OrderBy(x => x.Tag.Name)
                        .AsEnumerable()
                        .Select(x => new TagDetailsViewModel(x))
                        .ToList();
        }
        /// <summary>
        /// Populates properties on the view model from an instance of the
        /// DataStore class.
        /// </summary>
        /// <param name="model">The DataStore to reference.</param>
        private void ReadEntityProperties(DataStore model)
        {
            // Properties from the entity.
            this.Id                  = model.Id;
            this.Name                = model.Name;
            this.Capacity            = model.Capacity;
            this.FreeSpace           = model.FreeSpace;
            this.CreatedDate         = model.CreatedDate;
            this.LastUpdated         = model.LastUpdated;
            this.Inactive            = model.Inactive;
            this.InactiveDate        = model.InactiveDate;
            this.LocalStorage        = model.LocalStorage;
            this.UsedCapacityPercent = model.UsedCapacityPercent;
            this.TotalCapacity       = model.TotalCapacity;
            this.UsedCapacity        = model.UsedCapacity;
            if (model.DataStoreCategory != null)
            {
                this.DataStoreCategory = new DataStoreCategoryReferenceViewModel(model.DataStoreCategory);
            }
            else
            {
                this.DataStoreCategory = null;
            }

            if (model.DataStoreGroup != null)
            {
                this.DataStoreGroup = new DataStoreGroupReferenceViewModel(model.DataStoreGroup);
            }
            else
            {
                this.DataStoreGroup = null;
            }

            // Calculated properties
            this.CapacityRulesInherited = model.DataStoreGroup != null && model.DataStoreGroup.CapacityRulesMetas.Count() > 0;

            // Related entities.
            IEnumerable <CapacityRulesMeta> rules;

            if (this.CapacityRulesInherited)
            {
                rules = model.DataStoreGroup.CapacityRulesMetas;
            }
            else
            {
                rules = model.CapacityRulesMetas;
            }

            this.CapacityRules = CapacityRuleListCalculationViewModel.SelectMany(rules, model);

            // Notes and Tags.
            this.Notes = model.Notes
                         .OrderByDescending(x => x.CreatedAt)
                         .AsEnumerable()
                         .Select(x => new NoteDetailsViewModel(x))
                         .ToList();

            this.Tags = model.TagsMetas
                        .OrderBy(x => x.Tag.Name)
                        .AsEnumerable()
                        .Select(x => new TagDetailsViewModel(x))
                        .ToList();
        }