@SuppressWarnings("rawtypes")
  public void load(
      EntitiesRegistry entitiesRegistry, Annotation annotation, Class<?> containingClass) {

    ScreenBinder screenBinder = (ScreenBinder) annotation;
    ScreenEntitiesRegistry screenEntitiesRegistry = (ScreenEntitiesRegistry) entitiesRegistry;

    SimpleScreenEntityDefinition screenEntityDefinition =
        (SimpleScreenEntityDefinition) screenEntitiesRegistry.get(containingClass);

    List<ScreenEntityBinder> binders = new ArrayList<ScreenEntityBinder>();
    Class<? extends ScreenEntityBinder>[] binderClasses = screenBinder.binders();
    for (Class<? extends ScreenEntityBinder> class1 : binderClasses) {
      try {
        binders.add(class1.newInstance());
      } catch (Exception e) {
        throw (new RegistryException(e));
      }
    }
    screenEntityDefinition.setBinders(binders);
    screenEntityDefinition.setPerformDefaultBinding(screenBinder.performDefaultBinding());

    logger.info("Added screen binders information to the registry for:" + containingClass);
  }
  @Override
  public void afterSendAction(TerminalConnection terminalConnection) {

    ScreenEntity currentEntity = getSession().getEntity();

    // if screen is not identified, exit
    if (currentEntity == null) {
      return;
    }

    ScreenEntityDefinition entityDefinition = screenEntitiesRegistry.get(currentEntity.getClass());

    int skippedScreens = 0;

    if (skipAction == null) {
      return;
    }

    // if screen is not messages screen, exit
    while (entityDefinition.getType() == Messages.MessagesEntity.class
        && skippedScreens < skipLimit) {
      ScreenPojoFieldAccessor fieldAccessor = new SimpleScreenPojoFieldAccessor(currentEntity);

      // collect all messages field into messages
      Collection<ScreenFieldDefinition> fieldDefinitions =
          entityDefinition.getFieldsDefinitions().values();
      ScreenFieldDefinition messagesFieldDefinition = null;
      for (ScreenFieldDefinition screenFieldDefinition : fieldDefinitions) {
        if (screenFieldDefinition.getType() == Messages.MessageField.class) {
          Object fieldValue = fieldAccessor.getFieldValue(screenFieldDefinition.getName());
          if (fieldValue instanceof String) {
            messagesFieldDefinition = screenFieldDefinition;
            messages.add((String) fieldValue);
          }
        }
      }
      if (messagesFieldDefinition == null) {
        throw (new RegistryException(
            MessageFormat.format(
                "Messages entity {0} doesnt contain a message field (@ScreenField(fieldType=MessagesField.class))",
                entityDefinition.getEntityClassName())));
      }

      // skip messages screen
      if (logger.isDebugEnabled()) {
        logger.debug(
            MessageFormat.format(
                "Skipping screen {0} using action {1}",
                entityDefinition.getEntityClassName(), skipAction.getClass().getSimpleName()));
      }
      getSession().doAction(skipAction);
      skippedScreens++;

      currentEntity = getSession().getEntity();

      if (currentEntity == null) {
        break;
      }
      entityDefinition = screenEntitiesRegistry.get(currentEntity.getClass());
    }
  }