protected int AddService(IService service) { int i = Services.Count; if (i == 0) { service.AddClients(MonitorClients); service.Pipeline = this; Services.Add(0, service); } else { service.AddClient(Services.Last().Value.Type); service.Pipeline = this; Services.Add(i, service); } return(i); }