public static void CloneAttendance(Attendance attendance, bool isSubroom, Location location, AttendanceService attendanceService, Request req) { Attendance newAttendance = ( Attendance )attendance.Clone(); newAttendance.Id = 0; newAttendance.Guid = new Guid(); newAttendance.StartDateTime = Rock.RockDateTime.Now; newAttendance.EndDateTime = null; newAttendance.DidAttend = true; newAttendance.Device = null; newAttendance.SearchTypeValue = null; newAttendance.LocationId = req.LocationId; newAttendance.AttendanceCode = null; newAttendance.AttendanceCodeId = attendance.AttendanceCodeId; if (isSubroom) { newAttendance.ForeignId = location.Id; } else { newAttendance.ForeignId = null; } attendanceService.Add(newAttendance); var stayedFifteenMinutes = (Rock.RockDateTime.Now - attendance.StartDateTime) > new TimeSpan(0, 15, 0); attendance.DidAttend = stayedFifteenMinutes; attendance.EndDateTime = Rock.RockDateTime.Now; InMemoryPersonStatus.RemoveFromWorship(attendance.PersonAlias.PersonId); InMemoryPersonStatus.RemoveFromWithParent(attendance.PersonAlias.PersonId); CheckInCountCache.AddAttendance(newAttendance); CheckInCountCache.RemoveAttendance(attendance); }