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