private static void ValidateRouteAllMessagesViaOnPremisesParameter(TenantOutboundConnector dataObject, IConfigDataProvider dataSession, Task task)
 {
     if (dataObject.RouteAllMessagesViaOnPremises && !NewInboundConnector.FindTenantScopedOnPremiseInboundConnector(dataSession, null))
     {
         task.WriteError(new CMCConnectorRequiresTenantScopedInboundConnectorException(), ErrorCategory.InvalidArgument, null);
     }
 }
 private static void ValidateCentralizedMailControlAndAssociatedAcceptedDomainsRestriction(IConfigDataProvider dataSession, TenantInboundConnector dataObject, Task task)
 {
     TenantOutboundConnector[] array = (TenantOutboundConnector[])dataSession.Find <TenantOutboundConnector>(null, null, true, null);
     foreach (TenantOutboundConnector tenantOutboundConnector in array)
     {
         if (tenantOutboundConnector.Enabled && tenantOutboundConnector.RouteAllMessagesViaOnPremises)
         {
             if (!NewInboundConnector.FindTenantScopedOnPremiseInboundConnector(dataSession, (TenantInboundConnector c) => ((ADObjectId)c.Identity).ObjectGuid != ((ADObjectId)dataObject.Identity).ObjectGuid))
             {
                 task.WriteError(new TenantScopedInboundConnectorRequiredForCMCConnectorException(tenantOutboundConnector.Name), ErrorCategory.InvalidArgument, null);
             }
             break;
         }
     }
 }