public OperationResultSet <Book> GetAllBooksByAuthor(string authorName, string userName, string guid) { if (!CheckAuthenticated(userName, guid)) { return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.NotAuthenticated, "Please authenticate first!")); } if (String.IsNullOrEmpty(authorName)) { return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.InvalidInputData, "Invalid or missing book author name")); } using (BookData dataProvider = new BookData()) { try { Book[] result = dataProvider.GetAllBooksByAuthor(authorName); if (result == null) { return(new OperationResultSet <Book>(new List <Book>())); } return(new OperationResultSet <Book>(new List <Book>(result))); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("BookManagement : GetAllBooksByAuthor : " + ex.StackTrace); return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.InternalProblem, "Some internal problem has occured")); } } }