class FhirResourceRepositoryImpl implements FhirResourceRepository {

    @Nonnull
    protected <T extends IBaseResource> T prepareResource( @Nonnull T resource, @Nullable String dhisResourceId )
    {
        final FhirResourceType fhirResourceType = FhirResourceType.getByResource( resource );

        if ( fhirResourceType == null )
        {
            throw new FhirResourceTransformationException( "Could not determine FHIR resource type for " + resource.getClass().getSimpleName() );
        }

        if ( fhirResourceType.isSyncDhisId() && dhisResourceId != null && !resource.getIdElement().hasIdPart() )
        {
            resource.setId( dhisResourceId );
        }

        return resource;
    }

    public  FhirResourceRepositoryImpl( @Nonnull ScriptExecutor scriptExecutor, @Nonnull StoredFhirResourceService storedItemService, @Nonnull FhirClientResourceRepository fhirClientResourceRepository,
        @Nonnull ObjectProvider<List<FhirContext>> fhirContexts, @Nonnull ObjectProvider<List<AbstractFhirResourceRepositorySupport>> supports );

}