/// <summary>
        /// Ctor - service channel id validator.
        /// </summary>
        /// <param name="model">Service channel id</param>
        /// <param name="channelService">Service channel service</param>
        /// <param name="userRole">Current user role.</param>
        /// <param name="propertyName">Property name</param>
        public ServiceChannelConnectionValidator(IVmOpenApiServiceServiceChannelInVersionBase model, IChannelService channelService, UserRoleEnum userRole,
                                                 string propertyName = "ServiceChannelId") : base(model, propertyName)
        {
            if (model == null)
            {
                throw new ArgumentNullException(PropertyName, $"{PropertyName} must be defined.");
            }

            this.channelService = channelService;
            this.userRole       = Model.IsASTIConnection ? UserRoleEnum.Eeva : userRole; // The Asti users have Eeva rights when adding connections - no visibility of channel is checked!

            channelValidator = new ServiceChannelIdValidator(model.ChannelGuid, channelService, userRole, propertyName, "ServiceChannelId");
        }
        /// <summary>
        /// Validates service channel id list.
        /// </summary>
        /// <returns></returns>
        public override void Validate(ModelStateDictionary modelState)
        {
            if (Model == null)
            {
                return;
            }

            var i = 0;

            Model.ForEach(id =>
            {
                var channelId = new ServiceChannelIdValidator(id, channelService, userRole, $"[{ i++ }].{PropertyName}");
                channelId.Validate(modelState);
            });
        }
        /// <summary>
        /// Validates service channels
        /// </summary>
        /// <param name="modelState"></param>
        public override void Validate(ModelStateDictionary modelState)
        {
            if (Model == null)
            {
                return;
            }

            Guid?channelId = Model.Count > 0 ? Model.First().ChannelGuid : (Guid?)null;

            if (!channelId.HasValue)
            {
                return;
            }

            var channelValidator = new ServiceChannelIdValidator(channelId.Value, channelService, UserRoleEnum.Eeva, "ServiceChannelId"); // this is always asti connection so we won't check the channel for visibility by setting user role as Eeva!

            channelValidator.Validate(modelState);
            if (!modelState.IsValid)
            {
                return;
            }

            var channel = channelValidator.ServiceChannel;

            if (channel.ServiceChannelType != ServiceChannelTypeEnum.ServiceLocation.ToString() && Model.Any(c => c.ServiceHours?.Count > 0 || c.ContactDetails != null))
            {
                modelState.AddModelError(PropertyName, string.Format(CoreMessages.OpenApi.AdditionalInfoForConnection, channel.Id, channel.ServiceChannelType));
            }
            else
            {
                // Validate service ids
                var serviceIds = Model.Select(c => c.ServiceGuid).ToList();
                ServiceIdListValidator services = new ServiceIdListValidator(serviceIds, serviceService, "ServiceRelations", "ServiceId");
                services.Validate(modelState);
            }
        }