ConfigRemoveEntry <- function(configuration, dataset_type, store_format, dataset_name = NULL, var_name = NULL, level = NULL, position = NULL) {
  table_name <- paste0(gsub("-", "_", store_format), "_", dataset_type)
  if (!is.null(dataset_name) && !is.null(var_name)) {
    if (dataset_name == ".*") {
      if (var_name == ".*") {
        level <- 1
      } else {
        level <- 3
      }
    } else {
      if (var_name == ".*") {
        level <- 2
      } else {
        level <- 4
      }
    }

    position <- which(unlist(lapply(configuration[[table_name]][[level]], "[", 1)) == dataset_name &
                         unlist(lapply(configuration[[table_name]][[level]], "[", 2)) == var_name)[1]
    if (is.na(position)) {
      stop("No entry found that matches 'dataset_name' and 'var_name'.")
    }
  } else if (is.null(level) || is.null(position)) {
    stop("At least one of the couples ('dataset_name', 'var_name') or ('level', 'position') must be specified.")
  }
  
  level_entries <- length(configuration[[table_name]][[level]])
  if (position < 1 || position > level_entries + 1) {
    stop("'position' must be in the range [1, # of existing table entries in corresponding level]")
  }

  configuration[[table_name]][[level]][[position]] <- NULL

  configuration
}
