Moved query logic to repositories. Introduced query and metadata cache
Fixed matching expressions