/// <summary>
 ///   Updates local data about grammar with id.
 /// </summary>
 /// <param name="grammarId">Id of grammar that should updated.</param>
 /// <returns>
 ///   When resolved, an updated <see cref="Grammar" /> object. When rejected, an
 ///   <see cref="Exception" /> with info about error that occured.
 /// </returns>
 public static IPromise <Grammar> GetGrammar(string grammarId)
 {
     if (!GrammarList.ContainsKey(grammarId))
     {
         return(Promise <Grammar> .Rejected(new ApplicationException("Update grammar request error:\nRequested grammar not found.")));
     }
     if (GrammarList[grammarId].isTutorial)
     {
         return(WebAPI.GetTutorial(grammarId)
                .Then(grammar => {
             grammarList[grammarId] = grammar;
             SaveGrammarList();
             return grammar;
         }));
     }
     return(WebAPI.GetGrammar(grammarId)
            .Then(grammar => {
         grammarList[grammarId] = grammar;
         SaveGrammarList();
         return grammar;
     }));
 }