coverted logic to service