private bool matchMenuItemsAndRedirect(Window currentWindow, PostRequest request, USSDSession <Object> session, USSDResponse response)
        {
            foreach (MenuItem menuItem in currentWindow.getMenuItems())
            {
                if (menuItem.Index.Equals(request.getInputValue()))
                {
                    if (currentWindow.getMenuValueName() != null)
                    {
                        session[currentWindow.getMenuValueName()] = menuItem.Value;
                    }

                    if (menuItem.TargetWindow != null)
                    {
                        String windowId = whereToGo(menuItem, request, response, session);
                        request.redirectTo(windowId, session, response);

                        return(true);
                    }

                    break;
                }
            }

            return(false);
        }
        private bool matchInput(Window currentWindow, PostRequest request, USSDSession <Object> session, USSDResponse response)
        {
            String regExp = currentWindow.getInput().RegExp;

            String value = request.getInputValue();

            session[currentWindow.getInput().Name] = value;

            if (currentWindow.getInput().RegExp != null)
            {
                bool matches = regularExpressionMatches(regExp, value, request);

                if (!matches)
                {
                    request.redirectTo(currentWindow.getInput().OnErrorTargetWindow, session, response);
                    return(false);
                }
            }

            return(true);
        }