/// <summary>
 ///   Creates new grammar.
 /// </summary>
 /// <returns>
 ///   When resolved, a newly created <see cref="Grammar" /> object. When rejected, an
 ///   <see cref="Exception" /> with info about error that occured.
 /// </returns>
 public static IPromise <Grammar> CreateGrammar()
 {
     return(WebAPI.CreateGrammar()
            .Then(grammar => {
         grammarList.Add(grammar.id, grammar);
         SaveGrammarList();
         return grammar;
     }));
 }