/// <summary>
        /// The user has confirmed they would like to delete the specified schedule. Delete it.
        /// </summary>
        /// <param name="id">The primary key for the LawyerSchedule entity to delete</param>
        /// <returns>RedirectToPageResult to Index upon successful deletion. HTTP 404 is returned if the
        /// signed in user does not own the schedule or the schedule couldn't be found. Returns HTTP 500
        /// if a database error occurred.</returns>
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id.HasValue)
            {
                Lawyer lawyer = await _lawyerService.GetLawyerByPrincipalAsync(User);

                LawyerSchedule = lawyer.LawyerSchedules.FirstOrDefault(ls => ls.ID == id.Value);

                if (LawyerSchedule != null)
                {
                    // The provided id checks out; attempt to delete the schedule
                    if (await _lawyerService.DeleteScheduleAsync(LawyerSchedule))
                    {
                        return(RedirectToPage("Index"));
                    }

                    // A database error has occurred; return 500 to indicate database error
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }

            // The schedule could not be found or it did not belong to the signed in user
            return(NotFound());
        }