public JsonResult ExecutiveSetup(OfficeExecutive executive, HttpPostedFileBase photo, HttpPostedFileBase sign, string joiningDate)
        {
            executive.PresentThanaId   = executive.PresentThanaId == 0 ? null : executive.PresentThanaId;
            executive.PermanentThanaId = executive.PermanentThanaId == 0 ? null : executive.PermanentThanaId;
            executive.TeamId           = executive.TeamId == 0 ? null : executive.TeamId;

            var joining = ReportHelper.FormatDate(joiningDate);

            executive.JoiningDate = joining;
            if (executive.Id == 0)
            {
                executive.EntryUserId = SessionHelper.LoggedInUserId;
                executive.EntryDate   = DateTime.Now;
                executive.IsActive    = true;
                if (photo != null)
                {
                    executive.Photograph = ReportHelper.ConvertStreamToByte(photo.InputStream);
                }
                if (sign != null)
                {
                    executive.Signature = ReportHelper.ConvertStreamToByte(sign.InputStream);
                }

                if (
                    officeExecutiveService.GetAll()
                    .FirstOrDefault(x => x.ExecutiveCode.ToLower() == executive.ExecutiveCode.ToLower()) != null)
                {
                    return(Json(new { Status = false, Message = "Duplicate executive code." }, JsonRequestBehavior.AllowGet));
                }

                officeExecutiveService.Create(executive);
                return(Json(new { Status = true, Message = "New executive created successfully." },
                            JsonRequestBehavior.AllowGet));
            }
            var existExecutive = officeExecutiveService.GetById(executive.Id);

            existExecutive.ExecutiveName    = executive.ExecutiveName;
            existExecutive.ExecutiveCode    = executive.ExecutiveCode;
            existExecutive.OrganizationId   = executive.OrganizationId;
            existExecutive.DesignationId    = executive.DesignationId;
            existExecutive.DepartmentId     = executive.DepartmentId;
            existExecutive.JoiningDate      = executive.JoiningDate;
            existExecutive.FatherName       = executive.FatherName;
            existExecutive.MotherName       = executive.MotherName;
            existExecutive.GenderId         = executive.GenderId;
            existExecutive.PresentAddress   = executive.PresentAddress;
            existExecutive.PresentThanaId   = executive.PresentThanaId;
            existExecutive.PermanentAddress = executive.PermanentAddress;
            existExecutive.PermanentThanaId = executive.PermanentThanaId;
            existExecutive.CountryId        = executive.CountryId;
            existExecutive.Email            = executive.Email;
            existExecutive.Mobile           = executive.Mobile;
            existExecutive.TeamId           = executive.TeamId;
            if (photo != null)
            {
                existExecutive.Photograph = ReportHelper.ConvertStreamToByte(photo.InputStream);
            }
            if (sign != null)
            {
                existExecutive.Signature = ReportHelper.ConvertStreamToByte(sign.InputStream);
            }
            existExecutive.UpdateUserId = SessionHelper.LoggedInUserId;
            existExecutive.UpdateDate   = DateTime.Now;

            if (
                officeExecutiveService.GetAll()
                .FirstOrDefault(x => x.ExecutiveCode.ToLower() == executive.ExecutiveCode.ToLower() && x.Id != executive.Id) !=
                null)
            {
                return(Json(new { Status = false, Message = "Duplicate executive code." }, JsonRequestBehavior.AllowGet));
            }

            officeExecutiveService.Update(existExecutive);
            return(Json(new { Status = true, Message = "Executive updated successfully." },
                        JsonRequestBehavior.AllowGet));
        }