public void AddSession(ISessionViewModel session) { using (var connection = DependencyService.Get <ISQLite>().GetConnection()) { var sessionRow = new SessionRow { SessionDefinitionId = session.SessionDefinitionId, SessionName = session.SessionName, SessionDate = session.SessionDate }; connection.Insert(sessionRow); session.SessionId = sessionRow.SessionId; foreach (var workout in session.SessionWorkOuts) { workout.SessionId = session.SessionId; _workoutRepository.AddWorkOut(workout); foreach (var set in workout.WorkOutSets) { set.WorkOutId = workout.WorkOutId; _setRepository.AddSet(set); } } } }