void Index(AObject aObj) { Object.AObject myObj = null; if (aObj is Server) { myObj = new Object.Server { Object = aObj as Server }; } else if (aObj is Channel) { myObj = new Object.Channel { Object = aObj as Channel }; } else if (aObj is Bot) { myObj = new Object.Bot { Object = aObj as Bot }; } else if (aObj is Packet) { myObj = new Object.Packet { Object = aObj as Packet }; } if (_client != null && myObj != null) { string type = myObj.GetType().Name.ToLower(); try { _client.Index(myObj, i => i.Index(_index).Type(type).Id(myObj.Guid.ToString())); } catch (Exception ex) { Log.Fatal("Index(" + aObj + ")", ex); } } }