Move all shared endpoint logic to an Endpoint parent class

There was still a lot of duplicate code in the endpoint classes.