private void OnPostAddRuleFinished(RuleResponse ruleResponse, string oldRuleID)
        {
            var rule = m_DataManager.GetRuleByID(oldRuleID);

            m_DataManager.DeleteRule(oldRuleID);
            rule.id = ruleResponse.id;
            m_DataManager.UpdateRule(rule);
            m_DataManager.RemoveRuleFromAddedRuleIDs(rule.id);
            m_DataManager.SetLastCachedRulesList();
            DoCleanUp();
        }
        private static void ParseAddRuleResponse(string json, string oldRuleId, Action <Exception> responseParseErrorCallback)
        {
            RuleResponse response;

            try
            {
                response = JsonUtility.FromJson <RuleResponse>(json);
            }
            catch (Exception e)
            {
                response = new RuleResponse();
                Debug.LogWarning("POST Add Rule reponse was not valid JSON:\n" + json + "\n" + e);
                responseParseErrorCallback?.Invoke(e);
            }
            postAddRuleFinished?.Invoke(response, oldRuleId);
        }