private UPnPError OnGetNowNextProgramForGroup(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfoAsync programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfoAsync; if (programInfo == null) { return(new UPnPError(500, "IProgramInfo service not available")); } int channelGroupId = (int)inParams[0]; IList <IProgram> programs = new List <IProgram>(); // Flatten to simple list for UPnP transfer var result = programInfo.GetNowAndNextForChannelGroupAsync(new ChannelGroup { ChannelGroupId = channelGroupId }).Result; if (result.Success) { foreach (KeyValuePair <int, IProgram[]> nowNextProgram in result.Result) { foreach (var program in nowNextProgram.Value) { if (program != null) { programs.Add(program); } } } } outParams = new List <object> { true, programs }; return(null); }