Merge pull request #11 from asobolev/master

refactoring and simple test for metadata service

LGTM
refactoring metadata service
added tests to MetadataService