public BotResponse AddRequest(UserContextState state, BotRequest request)
        {
            state.AddResponse(state.CurrentDialog.Id, request);
            var serialDia = state.CurrentDialog.Owner as SerialDialog;

            if (serialDia != null)
            {
                return(new BotResponse(null, BotResponse.ResponseType.Dialog, state.User, serialDia.Next(state.CurrentDialog)));
            }

            return(new BotResponse(null, BotResponse.ResponseType.Dialog, state.User, state.CurrentDialog));
        }
        public void SetState(UserContextState state)
        {
            // first initialize context if not initialized
            if (!ContextCollection.ContainsKey(state.User.UserId))
            {
                ContextCollection.Add(state.User.UserId, state);
            }

            else
            {
                ContextCollection[state.User.UserId] = state;
            }
        }
        /// <summary>
        /// Returns current user state or create new one
        /// </summary>
        public UserContextState GetUserState(IUser user)
        {
            if (IgnoredContexts.Contains(user.UserId))
            {
                return(null);
            }

            if (!ContextCollection.ContainsKey(user.UserId))
            {
                UserContextState state = new UserContextState(user);
                SetState(state);
                return(state);
            }
            else
            {
                return(ContextCollection[user.UserId]);
            }
        }