public Attendance CreateNewInstance(Attendance exist, Schedule schedule) { _attendanceRepository.Evict(exist); var o = _employeeRepository.Get(exist.Agent.Id); var entity = _entityFactory.Create <Attendance>() .SetProperties <Attendance>(o, schedule.Campaign, schedule.Start, schedule.End); entity.SchedulingPayload = _entityFactory.Create <SchedulingPayload>(); entity.CopyRule(o); entity.Joined = false; return(entity); }