public void SaveHerokuAuth(TokenCreateM model)
        {
            try
            {
                //if (model.Pairs == null) throw BadRequest("Must have 'pair'");
                //if (model.Pairs.Count == 0) throw BadRequest("Must have 'pair'");
                //if (model.Pairs.Count != 2) throw BadRequest("Pairs for Heroku must have 2 pairs");
                //if (!model.Pairs[0].Key.Equals("Login") || !model.Pairs[1].Key.Equals("Password")) throw BadRequest("Unidentified key");
                //if (string.IsNullOrEmpty(model.Pairs[0].Value) || string.IsNullOrEmpty(model.Pairs[1].Value)) throw BadRequest("Value must not null!");

                //Directory.CreateDirectory("Heroku");
                //string content = "machine api.heroku.com\n" +
                //    "  login " + model.Pairs[0].Value + "\n" +
                //    "  password " + model.Pairs[1].Value + "\n" +
                //    "machine git.heroku.com\n" +
                //    "  login " + model.Pairs[0].Value + "\n" +
                //    "  password " + model.Pairs[1].Value;
                //File.WriteAllTextAsync("Heroku/" + model.ProjectId.ToString() + ".txt", content).GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                throw e is RequestException ? e : _errorHandler.WriteLog("An error occurred!",
                                                                         e, DateTime.Now, "Server", "Service-ConfigurationFile-SaveHerokuAuth");
            }
        }
 public IActionResult Add([FromBody] TokenCreateM model)
 {
     try
     {
         JwtClaimM jwt_claim = _jwtAuth.GetClaims(Request);
         if (model.ToolId.Equals(ToolID.CircleCI))
         {
             var circle_user = _circleCIUser.Get(model.Token);
             return(Ok(_token.Add(circle_user.Id, null, circle_user.Login, null, model.Token, model.ToolId, jwt_claim.UserId)));
         }
         else if (model.ToolId.Equals(ToolID.Heroku))
         {
             var heroku_account = _herokuAccount.Get(model.Token);
             return(Ok(_token.Add(heroku_account.Id, heroku_account.Email, heroku_account.Name, null, model.Token, ToolID.Heroku, jwt_claim.UserId)));
         }
         return(NotFound());
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }