ConfigAddEntry <- function(configuration, dataset_type, store_format, position = 'last', dataset_name = ".*", var_name = ".*", main_path = "*", file_path = "*", nc_var_name = "*", grid = "*", suffix = "*", varmin = "*", varmax = "*") {
  table_name <- paste0(gsub("-", "_", store_format), "_", dataset_type)
  if (dataset_name == ".*") {
    if (var_name == ".*") {
      level <- 1
    } else {
      level <- 3
    }
  } else {
    if (var_name == ".*") {
      level <- 2
    } else {
      level <- 4
    }
  }
  
  level_entries <- length(configuration[[table_name]][[level]])
  if (position == 'last') {
    position <- level_entries + 1
  }
  
  if (position < 1 || position > level_entries + 1) {
    stop("'position' must be in the range [1, # of existing table entries in corresponding level]")
  }

  if (dataset_type == 'experiments') {
    configuration[[table_name]][[level]] <- append(configuration[[table_name]][[level]], list(c(dataset_name, var_name, main_path, file_path, nc_var_name, grid, suffix, varmin, varmax)), after = position - 1)
  } else if (dataset_type == 'observations') {
    configuration[[table_name]][[level]] <- append(configuration[[table_name]][[level]], list(c(dataset_name, var_name, main_path, file_path, nc_var_name, suffix, varmin, varmax)), after = position - 1)
  } else {
    stop("'dataset_type' must be one of 'experiments' or 'observations'")
  }

  configuration
}
