implemented realm for API