/// <summary>
        /// The SendPushNotificationToStudent.
        /// </summary>
        /// <param name="assignment">The assignment<see cref="TeacherAssignment"/>.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        private async Task SendPushNotificationToStudent(TeacherAssignment assignment)
        {
            try
            {
                var pushNotification = new PushNotification
                {
                    Title = assignment.SubjectName,
                    Body  = assignment.AssignmentName
                };

                var studentData = await _tableStorage.GetAllAsync <Entites.Student>("Student");

                var students = studentData.Where(s => s.PartitionKey == assignment.SchoolId && s.ClassId == assignment.ClassId);
                foreach (var student in students)
                {
                    if (!String.IsNullOrEmpty(student.NotificationToken))
                    {
                        pushNotification.RecipientDeviceToken = student.NotificationToken;
                        await _pushNotificationService.SendAsync(pushNotification);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new AppException("Exception thrown in Notify Service: ", ex.InnerException);
            }
        }
        /// <summary>
        /// The CreateTeacherAssigments.
        /// </summary>
        /// <param name="model">The model<see cref="TeacherAssignment"/>.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task CreateTeacherAssigments(TeacherAssignment model)
        {
            var assignments = await _tableStorage.GetAllAsync <Entites.Assignment>("Assignment");

            var content = assignments.SingleOrDefault(assignment => assignment.RowKey == model.Id);

            if (content != null)
            {
                content.Active    = model.Active;
                content.UpdatedOn = DateTime.UtcNow;
                content.UpdatedBy = model.CreatedBy;

                try
                {
                    await _tableStorage.UpdateAsync("Assignment", content);
                }
                catch (Exception ex)
                {
                    throw new AppException("Update assignment error: ", ex.InnerException);
                }
            }
            else
            {
                var assignmentId = String.IsNullOrEmpty(model.Id) ? Guid.NewGuid().ToString() : model.Id;

                var assignment = new Entites.Assignment(model.SchoolId, assignmentId)
                {
                    AssignmentName        = model.AssignmentName,
                    AssignmentDescription = model.AssignmentDescription,
                    AssignmentLevel       = model.AssignmentLevel,
                    AssignmentURL         = model.AssignmentURL,
                    ClassId     = model.ClassId,
                    SubjectName = model.SubjectName,

                    Active    = true,
                    CreatedBy = model.CreatedBy,
                    UpdatedOn = DateTime.UtcNow,
                    UpdatedBy = model.CreatedBy,
                };
                try
                {
                    await _tableStorage.AddAsync("Assignment", assignment);
                    await SendPushNotificationToStudent(model);
                }
                catch (Exception ex)
                {
                    throw new AppException("Create assignment error: ", ex.InnerException);
                }
            }
        }
        public async Task <IActionResult> TeacherAssignment(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "assignment/create")]
            [RequestBodyType(typeof(TeacherAssignment), "Create/update assignment")] HttpRequest request)
        {
            var validateStatus = base.AuthorizationStatus(request);

            if (validateStatus != System.Net.HttpStatusCode.Accepted)
            {
                return(new BadRequestObjectResult(validateStatus));
            }

            string            requestBody = await new StreamReader(request.Body).ReadToEndAsync();
            TeacherAssignment requestData = JsonConvert.DeserializeObject <TeacherAssignment>(requestBody);

            await _assignmentService.CreateTeacherAssigments(requestData);

            return(new OkObjectResult(new { message = "Assignment created successfull." }));
        }