CanConnect() private method

private CanConnect ( IComponentCommunication connectingCommunicationInterface ) : bool
connectingCommunicationInterface IComponentCommunication
return bool
        internal void TryDisconnect( ComponentModel disconnectingComponent )
        {
            var disconnectingComponentInterface = disconnectingComponent.Component as IConnectableComponent;
             if ( disconnectingComponentInterface != null )
             {
            var disconnectingCommunicationInterface = disconnectingComponentInterface.GetCommunicationInterface();
            if ( disconnectingCommunicationInterface != null )
            {
               var canDisconnect = CanConnect( disconnectingCommunicationInterface );
               if ( canDisconnect )
               {
                  _logger.Info( "Disconnecting the component '{0}' to the component '{1}'", Component.Name, disconnectingComponentInterface.Name );

                  dynamic fe = Component;
                  dynamic bc = disconnectingCommunicationInterface;
                  fe.DisconnectComponent( bc ); // TODO: Change this to another method name

                  // update model
                  Remove( disconnectingComponent );
                  disconnectingComponent.Remove( this );

                  _logger.Info( "Disconnected the component '{0}' to the component '{1}'", Component.Name, disconnectingComponentInterface.Name );
               }
            }
             }
             else
             {
            // try to connect the other way, if the connecting component was not a connectable
            var thisComponent = Component as IConnectableComponent;
            if ( thisComponent != null )
            {
               var thisComponentCommunicationInterface = thisComponent.GetCommunicationInterface();
               if ( thisComponentCommunicationInterface != null )
               {
                  var canDisconnect = disconnectingComponent.CanConnect( thisComponentCommunicationInterface );
                  if ( canDisconnect )
                  {
                     _logger.Info( "Connecting the component '{0}' to the component '{1}'", disconnectingComponentInterface.Name, Component.Name );

                     dynamic fe = disconnectingComponent.Component;
                     dynamic bc = thisComponentCommunicationInterface;
                     fe.DisconnectComponent( bc ); // TODO: Change this to another method name

                     // update model
                     Remove( disconnectingComponent );
                     disconnectingComponent.Remove( this );

                     _logger.Info( "Connected the component '{0}' to the component '{1}'", disconnectingComponentInterface.Name, Component.Name );
                  }
               }
            }
             }
        }
        internal void TryConnect( ComponentModel connectingComponent )
        {
            var connectingComponentInterface = connectingComponent.Component as IConnectableComponent;
             if ( connectingComponentInterface != null )
             {
            var connectingCommunicationInterface = connectingComponentInterface.GetCommunicationInterface();
            if ( connectingCommunicationInterface != null )
            {
               var canConnect = CanConnect( connectingCommunicationInterface );
               if ( canConnect )
               {
                  _logger.Info( "Connecting the component '{0}' to the component '{1}'", Component.Name, connectingComponentInterface.Name );

                  dynamic fe = Component;
                  dynamic bc = connectingCommunicationInterface;
                  fe.ConnectComponent( bc );

                  // update model
                  Add( connectingComponent );
                  connectingComponent.Add( this );

                  _logger.Info( "Connected the component '{0}' to the component '{1}'", Component.Name, connectingComponentInterface.Name );
               }
            }
             }
             else
             {
            // try to connect the other way, if the connecting component was not a connectable
            var thisComponent = Component as IConnectableComponent;
            if ( thisComponent != null )
            {
               var thisComponentCommunicationInterface = thisComponent.GetCommunicationInterface();
               if ( thisComponentCommunicationInterface != null )
               {
                  var canConnect = connectingComponent.CanConnect( thisComponentCommunicationInterface );
                  if ( canConnect )
                  {
                     _logger.Info( "Connecting the component '{0}' to the component '{1}'", connectingComponent.Component.Name, Component.Name );

                     dynamic fe = connectingComponent.Component;
                     dynamic bc = thisComponentCommunicationInterface;
                     fe.ConnectComponent( bc );

                     // update model
                     Add( connectingComponent );
                     connectingComponent.Add( this );

                     _logger.Info( "Connected the component '{0}' to the component '{1}'", connectingComponent.Component.Name, Component.Name );
                  }
               }
            }
             }
        }