/// <summary>
 /// Gets a specified study session by Id
 /// </summary>
 /// <param name="id">The Id of the study session to get</param>
 /// <returns>A single study session or null if the specified assignment doesn't exist</returns>
 public async Task <StudySession> GetStudySessionById(int?id)
 {
     return(await StudySessions
            .Include(s => s.Course)
            .Include(s => s.StudySessionType)
            .FirstOrDefaultAsync(s => s.Id == id));
 }
        /// <summary>
        /// Gets all active or non-active study sessions in the database
        /// </summary>
        /// <param name="onlyActive">True = only active study sessions, false = only non-active study sessions</param>
        /// <returns>An Iqueryable object of type StudySession</returns>
        public IQueryable <StudySession> GetStudySessions(bool onlyActive)
        {
            IQueryable <StudySession> studySessions = StudySessions
                                                      .Include(sa => sa.StudySessionType)
                                                      .Include(sa => sa.Course);

            if (onlyActive)
            {
                studySessions = studySessions.Where(sa => DateTime.Now.CompareTo(sa.GetStudySessionEnd()) < 0 && sa.IsCompleted == false);
            }
            return(studySessions);
        }