internal SubmissionObject(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                //Debug.Assert(model.AssignmentId != null, "model.AssignmentId != null");
                //Debug.Assert(model.UserId != null, "model.UserId != null");

                AssignmentId = model.AssignmentId;
                Assignment   = model.Assignment.ConvertIfNotNull(m => new Assignment(api, m));
                Course       = model.Course.ConvertIfNotNull(c => new Course(api, c));
                Attempt      = model.Attempt;
                Body         = model.Body;
                Grade        = model.Grade;
                GradeMatchesCurrentSubmission = model.GradeMatchesCurrentSubmission;
                PreviewUrl         = model.PreviewUrl;
                Score              = model.Score;
                SubmissionComments = model.SubmissionComments.ConvertIfNotNull(ie => ie.Select(m => new SubmissionComment(api, m)));
                SubmissionType     = model.SubmissionType;
                SubmittedAt        = model.SubmittedAt;
                Url               = model.Url;
                UserId            = model.UserId;
                GraderId          = model.GraderId;
                GradedAt          = model.GradedAt;
                User              = model.User.ConvertIfNotNull(m => new User(api, m));
                Late              = model.Late;
                AssignmentVisible = model.AssignmentVisible;
                Excused           = model.Excused;
                Missing           = model.Missing;
                LatePolicyStatus  = model.LatePolicyStatus;
                PointsDeducted    = model.PointsDeducted;
                SecondsLate       = model.SecondsLate;
                WorkflowState     = model.WorkflowState;
                ExtraAttempts     = model.ExtraAttempts;
                AnonymousId       = model.AnonymousId;
            }
            internal Conversation(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                Debug.Assert(model.ConversationId != null, "model.ConversationId != null");

                ConversationId   = (ulong)model.ConversationId;
                Private          = model.Private;
                ParticipantCount = model.ParticipantCount;
            }
            internal Announcement(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                Debug.Assert(model.AnnouncementId != null, "model.AnnouncementId != null");

                TotalRootDiscussionEntries = model.TotalRootDiscussionEntries;
                RequireInitialPost         = model.RequireInitialPost;
                UserHasPosted         = model.UserHasPosted;
                RootDiscussionEntries = model.RootDiscussionEntries;
                AnnouncementId        = (ulong)model.AnnouncementId;
            }
 internal static ActivityStreamObject FromModel(Api api, ActivityStreamObjectModel model)
 {
     return(model.Type switch {
         "DiscussionTopic" => (ActivityStreamObject) new DiscussionTopic(api, model),
         "Announcement" => new Announcement(api, model),
         "Conversation" => new Conversation(api, model),
         "Message" => new Message(api, model),
         "Conference" => new Conference(api, model),
         "Collaboration" => new Collaboration(api, model),
         "AssignmentRequest" => new AssignmentRequest(api, model),
         "Submission" => new SubmissionObject(api, model),
         _ => throw new NotImplementedException("unknown ActivityStreamObject type " + model.Type)
     });
 internal ActivityStreamObject(Api api, ActivityStreamObjectModel model)
 {
     Api         = api;
     CreatedAt   = model.CreatedAt;
     UpdatedAt   = model.UpdatedAt;
     Id          = model.Id;
     Title       = model.Title;
     BodyMessage = model.Message;
     Type        = model.Type;
     ReadState   = model.ReadState;
     ContextType = model.ContextType;
     CourseId    = model.CourseId;
     GroupId     = model.GroupId;
     HtmlUrl     = model.HtmlUrl;
 }
            internal AssignmentRequest(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                Debug.Assert(model.AssignmentRequestId != null, "model.AssignmentRequestId != null");

                AssignmentRequestId = (ulong)model.AssignmentRequestId;
            }
            internal Collaboration(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                Debug.Assert(model.CollaborationId != null, "model.CollaborationId != null");

                CollaborationId = (ulong)model.CollaborationId;
            }
            internal Conference(Api api, ActivityStreamObjectModel model) : base(api, model)
            {
                Debug.Assert(model.WebConferenceId != null, "model.WebConferenceId != null");

                WebConferenceId = (ulong)model.WebConferenceId;
            }
 internal Message(Api api, ActivityStreamObjectModel model) : base(api, model)
 {
     MessageId            = model.MessageId;
     NotificationCategory = model.NotificationCategory;
 }