public static void RevokePermission(this RoleBasedSecurity roleBasedSecurity, List <Guid> ids, List <ActionItemEnum> actionItems)
        {
            actionItems.ForEach(action =>
            {
                if (ids == null)
                {
                    return;
                }
                switch (action)
                {
                case ActionItemEnum.Create:
                    roleBasedSecurity.IdsAllowedToCreate.RemoveAll(ids.Contains);
                    break;

                case ActionItemEnum.Read:
                    roleBasedSecurity.IdsAllowedToRead.RemoveAll(ids.Contains);
                    break;

                case ActionItemEnum.Update:
                    roleBasedSecurity.IdsAllowedToUpdate.RemoveAll(ids.Contains);
                    break;

                case ActionItemEnum.Delete:
                    roleBasedSecurity.IdsAllowedToDelete.RemoveAll(ids.Contains);
                    break;

                case ActionItemEnum.Share:
                    roleBasedSecurity.IdsAllowedToShare.RemoveAll(ids.Contains);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(action), action, null);
                }
            });
        }
        public static void ApplyPermission(this RoleBasedSecurity roleBasedSecurity, List <Guid> ids, List <ActionItemEnum> actionItems)
        {
            if (ids == null)
            {
                return;
            }
            actionItems.ForEach(action =>
            {
                switch (action)
                {
                case ActionItemEnum.Create:
                    var changedItems = ids.Except(roleBasedSecurity.IdsAllowedToCreate).ToList();
                    if (changedItems.Any())
                    {
                        roleBasedSecurity.IdsAllowedToCreate.AddRange(changedItems);
                    }
                    break;

                case ActionItemEnum.Read:
                    changedItems = ids.Except(roleBasedSecurity.IdsAllowedToRead).ToList();
                    if (changedItems.Any())
                    {
                        roleBasedSecurity.IdsAllowedToRead.AddRange(changedItems);
                    }
                    break;

                case ActionItemEnum.Update:
                    changedItems = ids.Except(roleBasedSecurity.IdsAllowedToUpdate).ToList();
                    if (changedItems.Any())
                    {
                        roleBasedSecurity.IdsAllowedToUpdate.AddRange(changedItems);
                    }
                    break;

                case ActionItemEnum.Delete:
                    changedItems = ids.Except(roleBasedSecurity.IdsAllowedToDelete).ToList();
                    if (changedItems.Any())
                    {
                        roleBasedSecurity.IdsAllowedToDelete.AddRange(changedItems);
                    }
                    break;

                case ActionItemEnum.Share:
                    changedItems = ids.Except(roleBasedSecurity.IdsAllowedToShare).ToList();
                    if (changedItems.Any())
                    {
                        roleBasedSecurity.IdsAllowedToShare.AddRange(changedItems);
                    }
                    break;
                }
            });
        }