public void ClearFilter()
 {
     var fil = new DriverLicenseFilterModel();
     Mapper.Map(fil, this.Filter);
 }
        public static List<DriverLicenseModel> FindDriverLicenses(DSModel db, DriverLicenseFilterModel filter)
        {
            if (db == null)
                throw new ArgumentNullException("db");

            var q = PredicateBuilder.True<DriversLicense>();
            if (!string.IsNullOrWhiteSpace(filter.DriverID))
            {
                uint[] ids = filter.DriverID.Split(',').Select(d => Convert.ToUInt32(d.Trim())).ToArray();
                q = q.And(d => ids.Contains(d.DriverID));
            }
            if (!string.IsNullOrWhiteSpace(filter.LicenseID))
            {
                uint[] ids = filter.LicenseID.Split(',').Select(d => Convert.ToUInt32(d.Trim())).ToArray();
                q = q.And(d => ids.Contains(d.LicenseID));
            }
            if (!string.IsNullOrWhiteSpace(filter.FirstName))
            {
                q = q.And(d => d.Driver.FirstName.StartsWith(filter.FirstName));
            }
            if (!string.IsNullOrWhiteSpace(filter.LastName))
            {
                q = q.And(d => d.Driver.LastName.StartsWith(filter.LastName));
            }
            if (filter.MVRFromDate.HasValue)
            {
                q = q.And(d => d.MVRReviewDate >= filter.MVRFromDate.Value.Date);
            }
            if (filter.MVRToDate.HasValue)
            {
                q = q.And(d => d.MVRReviewDate <= filter.MVRToDate.Value.Date);
            }


            return db.DriversLicenses
                .Where(q)
                .Select(l => new DriverLicenseModel(l))
                .ToList();
        }