class FunctionalityService {

    public List<FunctionalityWithChildrenDTO> deleteList(Long projectId, List<Long> ids) throws BadRequestException {
        if (CollectionUtils.isEmpty(ids)) {
            throw new BadRequestException(Messages.PARAMETER_IS_MISSING, Entities.FUNCTIONALITY, "delete_functionality_list_missing_ids_parameter");
        }

        List<Functionality> functionalitiesToDelete = repository.findByProjectIdAndIdIn(projectId, ids);
        Boolean thereAreSomeUnknownIds = ids.size() > functionalitiesToDelete.size();
        if (thereAreSomeUnknownIds) {
            throw new NotFoundException(Messages.NOT_FOUND_FUNCTIONALITY_OR_FOLDER, Entities.FUNCTIONALITY);
        }

        repository.deleteAll(functionalitiesToDelete);
        return findAllAsTree(projectId);
    }

}