internal static IPromise <GenerateGrammarResponse> GenerateGrammar(string grammarId) { return(!GrammarList.ContainsKey(grammarId) ? Promise <GenerateGrammarResponse> .Rejected(new ApplicationException("Generate grammar request error:\nRequested grammar not found.")) : WebAPI.GenerateGrammar(GrammarList[grammarId]) .Then(_ => { UpdateUserInfo(); return _; })); }