/// <summary>
        /// Adds <see cref="LayoutModule">modules</see> and <see cref="LayoutService">stations</see> in a <see cref="ModulePackage"/> to a <see cref="Layout"/>
        /// </summary>
        /// <param name="principal"></param>
        /// <param name="participantId"></param>
        /// <param name="layoutId"></param>
        /// <param name="package"></param>
        /// <returns></returns>
        public async Task <(int Count, string Message)> AddPackageModulesAsync(ClaimsPrincipal?principal, int participantId, int layoutId, ModulePackage package)
        {
            if (principal.IsAuthenticated())
            {
                var result = package.Modules.Count();
                using var dbContext = Factory.CreateDbContext();
                var participant = await dbContext.MeetingParticipants.Include(mp => mp.Meeting).SingleOrDefaultAsync(mp => mp.Id == participantId);

                if (participant is null)
                {
                    return(-1, Resources.Strings.NotFound);
                }
                foreach (var module in package.Modules)
                {
                    var existing = await dbContext.LayoutModules.SingleOrDefaultAsync(lm => lm.ModuleId == module.Id);

                    if (existing is null)
                    {
                        var addedModule = new LayoutModule {
                            LayoutId = layoutId, ModuleId = module.Id, ParticipantId = participant.Id, RegisteredTime = TimeProvider.Now
                        };
                        dbContext.LayoutModules.Add(addedModule);
                        await AddLayoutStationAsync(dbContext, participantId, layoutId, module);

                        await dbContext.SaveChangesAsync();
                    }
                    else
                    {
                        result--;
                    }
                }
                return(result == 0 ? (-1, Resources.Strings.NoModification) : (1, Resources.Strings.Saved));
    /// <summary>
    /// Adds <see cref="LayoutModule">modules</see> and <see cref="LayoutService">stations</see> in a <see cref="ModulePackage"/> to a <see cref="Layout"/>
    /// </summary>
    /// <param name="principal"></param>
    /// <param name="participantId"></param>
    /// <param name="layoutId"></param>
    /// <param name="package"></param>
    /// <returns></returns>
    public async Task <(int Count, string Message)> AddPackageModulesAsync(ClaimsPrincipal?principal, int layoutParticipantId, ModulePackage package)
    {
        if (principal.IsAuthenticated())
        {
            var result = package.Modules.Count();
            using var dbContext = Factory.CreateDbContext();
            var participant = await dbContext.LayoutParticipants
                              .SingleOrDefaultAsync(lp => lp.Id == layoutParticipantId);

            if (participant is null)
            {
                return(-1, Resources.Strings.NotFound);
            }
            foreach (var module in package.Modules)
            {
                var existing = await dbContext.LayoutModules.SingleOrDefaultAsync(lm => lm.ModuleId == module.Id && lm.LayoutParticipantId == layoutParticipantId);

                if (existing is null)
                {
                    var layoutModule = new LayoutModule {
                        ModuleId = module.Id, LayoutParticipantId = participant.Id, RegisteredTime = TimeProvider.Now
                    };
                    if (module.StationId.HasValue)
                    {
                        var layoutStation = new LayoutStation {
                            StationId = module.StationId.Value
                        };
                        layoutModule.LayoutStation = layoutStation;
                    }
                    dbContext.LayoutModules.Add(layoutModule);
                    await dbContext.SaveChangesAsync();
                }
                else
                {
                    result--;
                }
            }
            return(result == 0 ? (-1, Resources.Strings.NoModification) : (1, Resources.Strings.Saved));
        }
        return(0, Resources.Strings.NotAuthorized);
    }