public OperationResultSet <Book> GetAllBooksByTitle(string title, string userName, string guid) { if (!CheckAuthenticated(userName, guid)) { return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.NotAuthenticated, "Please authenticate first!")); } if (String.IsNullOrEmpty(title)) { return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.InvalidInputData, "Invalid or missing book title")); } using (BookData dataProvider = new BookData()) { try { Book[] result = dataProvider.GetAllBooksByTitle(title); 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 : GetAllBooksByTitle : " + ex.StackTrace); return(new OperationResultSet <Book>(Library.Models.OperationResult.ErrorEnum.InternalProblem, "Some internal problem has occured")); } } }