Added new Database operations to get max ids