public IEnumerable<Document> SearchDocuments(string token, string pattern) { _conn = new Connection(_connectionString); try { _conn.OpenConnection(); return !string.IsNullOrEmpty(_conn.GetUsernameByToken(token)) ? _conn.SearchDocuments(pattern) : null; } finally { _conn.CloseConnection(); } }