class WorkItemDefinitionRegistries {

    public WorkItemDefinitionCacheRegistry remove(final T item) {
        final WorkItemDefinitionCacheRegistry removed = registryMap.remove(keyProvider.apply(item));
        registryDestroyer.accept(removed);
        return removed;
    }

    public  WorkItemDefinitionRegistries(final Function<T, String> keyProvider,
                                        final Map<String, WorkItemDefinitionCacheRegistry> registryMap,
                                        final Consumer<WorkItemDefinitionCacheRegistry> registryDestroyer);

}