public HttpResponseMessage ChangeStatusMulti(HttpRequestMessage request, string statusName, string delegateId, string[] explanationId)
 {
     if (string.IsNullOrEmpty(explanationId.ToString()) || string.IsNullOrEmpty(statusName))
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, nameof(explanationId) + MessageSystem.NoValues + nameof(statusName) + MessageSystem.NoValues));
     }
     if (ModelState.IsValid)
     {
         var dateNow = DateTime.Now.Date;
         foreach (var item in explanationId)
         {
             var explanationEntity   = _explanationRequestService.GetExplanationDetail(Int32.Parse(item));
             var timesheet           = _explanationRequestService.GetFingerTimeSheetByExplanationID(Int32.Parse(item)).DayOfCheck.AddDays(2);
             var DateExRequestInPast = _commonService.GetDateExRequestInPast(explanationEntity.CreatedDate.Value);
             if (DateExRequestInPast.Date < dateNow)
             {
                 return(request.CreateResponse(HttpStatusCode.BadRequest, MessageSystem.ERROR_CHANGESTATUS_EXREQUEST_IN_PAST_NOT_MSG));
             }
             //Check if explanation request in aboutime set delegate default and status is Delegated,will not set delegate
             if (explanationEntity != null && statusName.Equals(CommonConstants.StatusDelegation))
             {
                 var group = __groupService.GetGroupById(explanationEntity.AppUserCreatedBy.GroupId.ToString());
                 if (group.EndDate != null && explanationEntity.CreatedDate != null)
                 {
                     if (group.EndDate.Value.Date < DateTime.Now.Date && group.StartDate <= explanationEntity.CreatedDate.Value.Date && group.EndDate >= explanationEntity.CreatedDate.Value.Date)
                     {
                         return(request.CreateResponse(HttpStatusCode.BadRequest, MessageSystem.ERROR_CHANGESTATUS_REQUEST_NOT_IN_DELEGATEDEFAULT_TIME_MSG));
                     }
                 }
             }
         }
         string error;
         if (_explanationRequestService.ChangeStatusMulti(explanationId, statusName, delegateId, out error))
         {
             _explanationRequestService.Save();
             return(request.CreateResponse(HttpStatusCode.OK, MessageSystem.Create_Explanation_Success));
         }
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, error));
     }
     else
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }