private IDataSourceAdapter Create(IMongoDbSourceAdapterConfiguration configuration)
        {
            Guard.NotNull("configuration", configuration);

            if (String.IsNullOrEmpty(configuration.ConnectionString))
            {
                throw Errors.ConnectionStringMissing();
            }

            if (String.IsNullOrEmpty(configuration.Collection))
            {
                throw Errors.CollectionNameMissing();
            }

            if (!String.IsNullOrEmpty(configuration.QueryFile) && !String.IsNullOrEmpty(configuration.Query))
            {
                throw Errors.AmbiguousQuery();
            }

            if (!String.IsNullOrEmpty(configuration.ProjectionFile) && !String.IsNullOrEmpty(configuration.Projection))
            {
                throw Errors.AmbiguousProjection();
            }

            var adapter = new MongoDbSourceAdapter(GetInstanceConfiguration(configuration));

            adapter.Initialize();
            return(adapter);
        }