public bool TryCreateHostGroup(string name)
 {
     using (var context = _contextCreator())
     {
         try
         {
             var service   = new ZabbixApi.Services.HostGroupService(context);
             var hostGroup = service.GetByName(name);
             if (hostGroup == null)
             {
                 hostGroup      = new HostGroup();
                 hostGroup.name = name;
                 hostGroup.Id   = service.Create(hostGroup);
             }
             if (hostGroup.Id != null)
             {
                 _HostGroupMetricsCache = hostGroup;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception ex)
         {
             MetricsErrorHandler.Handle(ex, string.Format("Error on configuring zabbix host group, zabbix api {0}", _url));
             return(false);
         }
     }
 }
        public bool TryCreateHostGroup(string name)
        {
            using (var context = _contextCreator())
            {
                try
                {
                    var service = new ZabbixApi.Services.HostGroupService(context);
                    var hostGroup = service.GetByName(name);
                    if (hostGroup == null)
                    {
                        hostGroup = new HostGroup();
                        hostGroup.name = name;
                        hostGroup.Id = service.Create(hostGroup);

                    }
                    if (hostGroup.Id != null)
                    {
                        _HostGroupMetricsCache = hostGroup;
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    MetricsErrorHandler.Handle(ex, string.Format("Error on configuring zabbix host group, zabbix api {0}", _url));
                    return false;
                }
            }
        }