public async Task <IActionResult> GetLibraries([Required] string authKey, [Required] string plexServerUrl, string[] libraryKeys, string[] types, string[] titles) { if (string.IsNullOrEmpty(authKey) || string.IsNullOrEmpty(plexServerUrl)) { return(BadRequest()); } List <Directory> libraries = await _plexService.GetLibraries(authKey, plexServerUrl); if (libraryKeys.Any()) { libraries = libraries .Where(c => libraryKeys.Contains(c.Key)) .ToList(); } if (types.Any()) { libraries = libraries .Where(c => types.Contains(c.Type, StringComparer.OrdinalIgnoreCase)) .ToList(); } if (titles.Any()) { libraries = libraries .Where(c => titles.Contains(c.Title, StringComparer.OrdinalIgnoreCase)) .ToList(); } return(Ok(libraries)); }