public Dictionary <GremlinVariable, GremlinVariable> GetNewToOldSelectedVarMap(GremlinToSqlContext context)
        {
            Dictionary <GremlinVariable, GremlinVariable> newToOldSelectedVarMap = new Dictionary <GremlinVariable, GremlinVariable>();

            if (context == null)
            {
                return(newToOldSelectedVarMap);
            }

            var allVariables = context.FetchVarsFromCurrAndChildContext();

            foreach (var variable in allVariables)
            {
                var oldSelectedVar = variable as GremlinSelectedVariable;
                if (oldSelectedVar != null && oldSelectedVar.IsFromSelect && !allVariables.Contains(oldSelectedVar.RealVariable))
                {
                    List <GremlinVariable> newSelectVariableList = context.Select(oldSelectedVar.SelectKey);
                    GremlinVariable        newSelectedVar;
                    switch (oldSelectedVar.Pop)
                    {
                    case GremlinKeyword.Pop.last:
                        newSelectedVar = newSelectVariableList.Last();
                        break;

                    case GremlinKeyword.Pop.first:
                        newSelectedVar = newSelectVariableList.First();
                        break;

                    default:
                        //TODO
                        throw new NotImplementedException("Can't process for now");
                    }
                    newToOldSelectedVarMap[newSelectedVar] = oldSelectedVar;
                }
            }
            return(newToOldSelectedVarMap);
        }