class EventServiceImpl implements EventService, LocalDhisRepositoryPersistCallback<Event> {

    @Nonnull
    protected Event update( @Nonnull Event event )
    {
        final ResponseEntity<ImportSummariesWebMessage> response;

        try
        {
            response = restTemplate.exchange( UPDATE_URI, HttpMethod.PUT, new HttpEntity<>( event ),
                ImportSummariesWebMessage.class, event.getId() );
        }
        catch ( HttpClientErrorException e )
        {
            if ( HttpStatus.CONFLICT.equals( e.getStatusCode() ) )
            {
                throw new DhisConflictException( "Event could not be updated: " + e.getResponseBodyAsString(), e );
            }

            throw e;
        }

        final ImportSummariesWebMessage result = Objects.requireNonNull( response.getBody() );

        if ( result.getStatus() != Status.OK )
        {
            throw new DhisImportUnsuccessfulException( "Response indicates an unsuccessful import: " +
                result.getStatus() );
        }

        return event;
    }

    @Autowired public  EventServiceImpl( @Nonnull @Qualifier( "userDhis2RestTemplate" ) RestTemplate restTemplate, @Nonnull RequestCacheService requestCacheService, @Nonnull PolledProgramRetriever polledProgramRetriever );

}