public DocumentStore CreateDocStore() { try { var docStore = new DocumentStore { Url = Url }; if (!DefaultDatabase.IsNullOrWhitespace()) { docStore.DefaultDatabase = DefaultDatabase.Trim(); } if (ResourceManagerId.HasValue) { docStore.ResourceManagerId = ResourceManagerId.Value; } if (!Username.IsNullOrWhitespace()) { docStore.Credentials = new NetworkCredential(Username, Password); } if (!ApiKey.IsNullOrWhitespace()) { docStore.ApiKey = ApiKey; } return(docStore); } catch (Exception ex) { throw new Exception("Could not create DocumentStore", ex); } }