Implement findByIds and remove unnecessary downcasting

resolves #132 and #228