/// <summary>
 /// I will check if attachments and role changed and update them
 /// </summary>
 /// <param name="workerInDb"></param>
 /// <param name="editworker"></param>
 /// <param name="role"></param>
 private void CheckAndUpdateEverything(ApplicationUser workerInDb, EditWorker editworker, IdentityRole role)
 {
     if (!workerInDb.Roles.Any(r => r.RoleId == role.Id))
     {
         workerInDb.Roles.Remove(workerInDb.Roles.First());
         workerInDb.Roles.Add(new IdentityUserRole()
         {
             RoleId = role.Id,
             UserId = workerInDb.Id
         });
     }
     if (workerInDb.Worker.Department.ID != editworker.IdOfDepartment)
     {
         workerInDb.Worker.Department   = _db.Departments.Find(editworker.IdOfDepartment);
         workerInDb.Worker.DepartmentID = editworker.IdOfDepartment;
     }
     if (editworker.ProfilePicture != null)
     {
         DeleteProfPicOfWorker(workerInDb.Worker.Pic);
         workerInDb.Worker.Pic = ConventionsOfHttpPostedFileBase.ForPostedPicture(editworker.ProfilePicture);
     }
     if (editworker.CV != null)
     {
         DeleteCVOfWorker(workerInDb.Worker.CV);
         workerInDb.Worker.Pic = ConventionsOfHttpPostedFileBase.ForCV(editworker.CV);
     }
     if (editworker.ContractOfEmployment != null)
     {
         DeleteContractOfEmployementOfWorker(workerInDb.Worker.ContractOfEmployment);
         workerInDb.Worker.Pic = ConventionsOfHttpPostedFileBase.ForContractOfEmployments(editworker.ContractOfEmployment);
     }
 }
        /// <summary>
        /// Make a new Worker
        /// </summary>
        /// <param name="newWorker"></param>
        /// <param name="departmentOfNewWorker"></param>
        /// <returns></returns>
        private Worker NewWorker(CreateWorker newWorker, Department departmentOfNewWorker)
        {
            Worker newWorkerToAdd = new Worker()
            {
                Address = newWorker.Address,
                Pic     = ConventionsOfHttpPostedFileBase.ForPostedPicture(newWorker.ProfilePicture),
                CV      = ConventionsOfHttpPostedFileBase.ForCV(newWorker.CV),
                ContractOfEmployment = ConventionsOfHttpPostedFileBase.ForContractOfEmployments(newWorker.ContractOfEmployment),
                FirstName            = newWorker.FirstName,
                LastName             = newWorker.LastName,
                DateOfBirth          = newWorker.DateOfBirth,
                Gender          = newWorker.Gender,
                BankAccount     = newWorker.BankAccount,
                Salary          = newWorker.Salary,
                Department      = _db.Departments.Single(s => s.ID == departmentOfNewWorker.ID),
                DepartmentID    = _db.Departments.Single(s => s.ID == departmentOfNewWorker.ID).ID,
                ApplicationUser = _db.Users.Find(newWorker.userID)
            };

            return(newWorkerToAdd);
        }