/// <summary>
        ///
        /// </summary>
        /// <param name="waid"></param>
        /// <param name="wsiid"></param>
        /// <returns></returns>
        public bool Assign(WorkAssignment asmt, WorkerSignin signin, string user)
        {
            int wid;

            //Assignments must be explicitly unassigned first; throws exception if either record is in assigned state
            if (signin == null)
            {
                throw new NullReferenceException("WorkerSignin is null");
            }
            if (asmt == null)
            {
                throw new NullReferenceException("WorkAssignment is null");
            }
            //
            // validate state of WSI and WA records
            assignCheckWSI_WAID_must_be_null(signin);
            assignCheckWSI_WID_cannot_be_null(signin);
            assignCheckWA_WSIID_must_be_null(asmt);
            assignCheckWA_legitimate_orphan(asmt, signin);
            wid = assignCheckWSI_cardnumber_match(signin);
            //
            // Link signin with work assignment
            signin.WorkAssignmentID = asmt.ID;
            asmt.workerSigninID     = signin.ID;
            asmt.workerAssignedID   = wid;
            //
            // update timestamps and save
            asmt.updatedByUser(user);
            signin.updatedByUser(user);
            unitOfWork.SaveChanges();
            log(asmt.ID, user, "WSIID:" + signin.ID + " Assign successful");
            return(true);
        }
 private void unassignBoth(WorkAssignment asmt, WorkerSignin signin, string user)
 {
     //Have both assignment and signin.
     if (signin == null || asmt == null)
     {
         throw new NullReferenceException("Signin and WorkAssignment are both null");
     }
     //Try unassign with WorkerSignin only
     signin.WorkAssignmentID = null;
     asmt.workerSigninID     = null;
     asmt.workerAssignedID   = null;
     asmt.updatedByUser(user);
     signin.updatedByUser(user);
     unitOfWork.SaveChanges();
     log(asmt.ID, user, "WSIID:" + signin.ID + " Unassign successful");
 }