public Result <ServiceResponse> AddBlacklistItems(AddBlacklistItemsRequest request)
        {
            if (!Authorization.HasPermission(PermissionKeys.Blacklists.InsertBatch))
            {
                throw new System.Exception("You have no permission for this action");
            }

            if (request.FeedItems == null || !request.FeedItems.Any())
            {
                throw new System.Exception("Please choose at least one feed item");
            }

            return(this.ExecuteMethod(() =>
            {
                request.CheckNotNull();

                var blacklist = request.FeedItems
                                .Where(x => x.FeedItemId > 0 && !string.IsNullOrWhiteSpace(x.Title))
                                .Select(x => new Models.BlacklistItem(x.FeedItemId, x.Title)).ToList();

                SimpleFeedlyDatabaseAccess.AddBlacklistItems(blacklist, request.IsDeleteFeedItem);

                return new ServiceResponse();
            }));
        }
        public Result <ServiceResponse> MarkCheckedFeedItem(MarkCheckedFeedItemRequest request)
        {
            return(this.ExecuteMethod(() =>
            {
                request.CheckNotNull();

                SimpleFeedlyDatabaseAccess.MarkCheckedFeedItem(request.Id, request.IsChecked);

                return new ServiceResponse();
            }));
        }
        public Result <ServiceResponse> MarkCheckedBatchFeedItems(MarkCheckedBatchFeedItemsRequest request)
        {
            if (request.Ids == null || !request.Ids.Any())
            {
                throw new System.Exception("Please choose at least one feed item");
            }

            return(this.ExecuteMethod(() =>
            {
                request.CheckNotNull();

                var ids = request.Ids.Distinct().ToList();

                SimpleFeedlyDatabaseAccess.MarkCheckedFeedItems(ids, request.IsChecked);

                return new ServiceResponse();
            }));
        }
        public ServiceResponse AddBlacklistItem(AddBlacklistItemRequest request)
        {
            if (!Authorization.HasPermission(PermissionKeys.Blacklists.Insert))
            {
                throw new System.Exception("You have no permission for this action");
            }

            using (var connection = SqlConnections.NewFor <Entities.RssChannelsRow>())
            {
                var channelEntity = connection.TryById <Entities.RssChannelsRow>(request.ChannelId);

                if (channelEntity != null)
                {
                    SimpleFeedlyDatabaseAccess.AddBlacklistItem(request.FeedItemId, request.Title, request.IsDeleteFeedItem);
                }
            }

            return(new ServiceResponse());
        }