IAsyncOperation<LampGroupCreateLampGroupResult> ILampGroupService.CreateLampGroupAsync(AllJoynMessageInfo info, IReadOnlyList<string> lampIDs, IReadOnlyList<string> lampGroupIDs, string lampGroupName, string language) { if (string.IsNullOrEmpty(lampGroupName)) return Task.FromResult(LampGroupCreateLampGroupResult.CreateFailureResult(12)).AsAsyncOperation(); //Name was empty if (lampIDs == null || lampGroupIDs == null || string.IsNullOrWhiteSpace(language)) return Task.FromResult(LampGroupCreateLampGroupResult.CreateFailureResult(11)).AsAsyncOperation(); //Invalid arguments string groupID = Guid.NewGuid().ToString(); LampGroup group = new LampGroup(lampGroupName, language, lampIDs, lampGroupIDs); LampGroups.Add(groupID, group); LampGroupProducer.Signals.LampGroupsCreated(new List<string>() { groupID }.AsReadOnly()); SaveLampGroups(); return Task.FromResult(LampGroupCreateLampGroupResult.CreateSuccessResult(0, groupID)).AsAsyncOperation(); }