public ActionResult Search(int page = 1)
        {
            // Create service instance
            AdminServiceClient sc = new AdminServiceClient();

            // Create model
            NonStandardHolidaySearchVM model = new NonStandardHolidaySearchVM();

            try
            {
                NonStandardHolidaySearchVMDC response = sc.SearchNonStandardHoliday(CurrentUser, CurrentUser, appID, "", null, page, PageSize, true);

                // Close service communication
                sc.Close();

                //Map response back to view model
                model.MatchList = Mapper.Map <IEnumerable <NonStandardHolidaySearchMatchDC>, List <NonStandardHolidaySearchMatchModel> >(response.MatchList);

                // Set paging values
                model.TotalRows  = response.RecordCount;
                model.PageSize   = SessionManager.PageSize;
                model.PageNumber = page;

                // Store the page number we were on
                SessionManager.NonStandardHolidayPageNumber = model.PageNumber;

                return(View(model));
            }
            catch (Exception e)
            {
                // Handle the exception
                string message = ExceptionManager.HandleException(e, sc);
                model.Message = message;

                return(View(model));
            }
        }
        /// <summary>
        /// Search for NonStandardHoliday items
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="searchCriteria"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="includeInActive"></param>
        /// <param name="specification"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public NonStandardHolidaySearchVMDC SearchNonStandardHoliday(string currentUser, string user, string appID, string overrideID, NonStandardHolidaySearchCriteriaDC searchCriteria, int page, int pageSize, bool includeInActive,
                                                                     ISpecification <NonStandardHoliday> specification, IRepository <NonStandardHoliday> dataRepository, IUnitOfWork uow)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == specification)
                {
                    throw new ArgumentOutOfRangeException("specification");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }

                #endregion

                using (uow)
                {
                    // Evaluate search criteria if supplied
                    if (null != searchCriteria)
                    {
                        EvaluateNonStandardHolidaySearchCriteria(searchCriteria, ref specification);
                    }

                    if (!includeInActive)
                    {
                        ISpecification <NonStandardHoliday> isActiveSpecification = new Specification <NonStandardHoliday>(x => x.IsActive == true);
                        specification = specification.And(isActiveSpecification);
                    }

                    // Set default sort expression
                    System.Linq.Expressions.Expression <Func <NonStandardHoliday, DateTime> > sortExpression = x => x.Date;

                    //Sort holidays in descending order
                    bool isAscendingSort = false;

                    // Find all items that satisfy the specification created above.
                    IEnumerable <NonStandardHoliday> dataEntities = dataRepository.Find <DateTime>(specification, sortExpression, isAscendingSort, page, pageSize);

                    // Get total count of items for search critera
                    int itemCount = dataRepository.Count(specification);

                    NonStandardHolidaySearchVMDC results = new NonStandardHolidaySearchVMDC();

                    // Convert to data contracts
                    List <NonStandardHolidaySearchMatchDC> destinations = Mapper.Map <IEnumerable <NonStandardHoliday>, List <NonStandardHolidaySearchMatchDC> >(dataEntities);

                    results.MatchList      = destinations;
                    results.SearchCriteria = searchCriteria;
                    results.RecordCount    = itemCount;

                    return(results);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                ExceptionManager.ShieldException(e);

                return(null);
            }
        }