SQL implementation of membership repository