private static void UpdateSensitiveVariableValues(string projectId, Dictionary<string, string> sensitiveVariablesDico)
        {
            if (sensitiveVariablesDico.Count == 0)
            {
                return;
            }

            var connectionString = ConfigurationManager.AppSettings["DbConnectionString"];

            var dataContext = new OctopusServerDataContext(connectionString);

            var project = dataContext.Projects.FirstOrDefault(p => p.Id == projectId);

            if (project == null)
            {
                throw new Exception("UpdateSensitiveVariableValues: Can\"t retrieve the project from the database");
            }

            var variableSet = dataContext.VariableSets.FirstOrDefault(v => v.Id == project.VariableSetId);

            if (variableSet == null)
            {
                throw new Exception("UpdateSensitiveVariableValues: Can\"t retrieve the variable set from the database");
            }

            var json = variableSet.JSON;

            if (string.IsNullOrEmpty(json))
            {
                throw new Exception("UpdateSensitiveVariableValues: variable set json is empty");
            }

            var variableList = JsonConvert.DeserializeObject<VariableList>(json);

            foreach (var entry in sensitiveVariablesDico)
            {
                var variable = variableList.Variables.FirstOrDefault(v => v.Id == entry.Key);
                if (variable == null) continue;
                variable.Value = entry.Value;
            }

            var newJson = JsonConvert.SerializeObject(variableList);

            variableSet.JSON = newJson;

            dataContext.SubmitChanges();
        }
        private static string GetSensitiveVariableValue(string projectId, string variableId)
        {
            var variableValue = string.Empty;

            var connectionString = ConfigurationManager.AppSettings["DbConnectionString"];

            var dataContext = new OctopusServerDataContext(connectionString);

            var project = dataContext.Projects.FirstOrDefault(p => p.Id == projectId);

            if (project == null) return variableValue;

            var variableSet = dataContext.VariableSets.FirstOrDefault(v => v.Id == project.VariableSetId);

            if (variableSet == null) return variableValue;

            var json = variableSet.JSON;

            if (string.IsNullOrEmpty(json)) return variableValue;

            var variableSetResource = JsonConvert.DeserializeObject<VariableSetResource>(json);

            var variable = variableSetResource.Variables.FirstOrDefault(v => v.Id == variableId);

            if (variable == null) return variableValue;

            variableValue = variable.Value;

            return variableValue;
        }