Extract some logic to a service