class LocalDhisResourceRepositoryTemplate {

    public boolean deleteById( @Nonnull String id, @Nonnull Function<String, T> prototypeFunction )
    {
        final RequestCacheContext context = requestCacheService.getCurrentRequestCacheContext();
        final Optional<LocalDhisResourceRepository<T>> repository = getRepository( context );

        return repository.map( tLocalDhisResourceRepository -> tLocalDhisResourceRepository.deleteById( id, getResourceKey( context ), prototypeFunction ) )
            .orElseGet( () -> persistCallback.persistDeleteById( id ) );
    }

    public  LocalDhisResourceRepositoryTemplate( @Nonnull Class<T> resourceClass, @Nonnull RequestCacheService requestCacheService,
        @Nonnull LocalDhisRepositoryPersistCallback<T> persistCallback );

}