public IActionResult CreateTrackedItem(
            string ownerIdentityName,
            [FromBody]  TrackedItemForCreationDto newTrackedItemDto)
        {
            if (newTrackedItemDto == null)
            {
                return(BadRequest());
            }

            if (ModelState.IsValid == false)
            {
                return(BadRequest(ModelState));
            }

            if (!_repo.ClassEntityExists(ownerIdentityName))
            {
                return(NotFound());
            }

            var finalTrackedItem = _mapper.Map <Entities.TrackedItem>(newTrackedItemDto);

            //START: Might be able to replace this by defining student name as a Key value for EFCore
            var trackedItems = _repo.GetAllTrackedItemsFromClass(ownerIdentityName);

            foreach (var s in trackedItems)
            {
                if (s.Name == finalTrackedItem.Name)
                {
                    return(UnprocessableEntity("There is already a Tracked Item with that name in this Class"));
                }
            }
            //STOP: Might be able to replace this by defining student name as a Key value for EFCore

            _repo.AddTrackedItem(ownerIdentityName, finalTrackedItem);
            if (!_repo.Save())
            {
                return(StatusCode(500, $"A problem happened while handling your request to create a Tracked Item with name:  {newTrackedItemDto.Name}."));
            }
            var trackedItemToReturn = _mapper.Map <TrackedItemDto>(finalTrackedItem);

            return(CreatedAtAction("GetTrackedItem", new
                                   { trackedItemId = trackedItemToReturn.Id }, trackedItemToReturn));
        }
        public async Task <TrackedItemDto> AddTrackedItem(string classEntityOwnerIdentityName, TrackedItemForCreationDto trackedItemToAdd)
        {
            var trackedItemForCreation =
                new StringContent(JsonSerializer.Serialize(trackedItemToAdd), Encoding.UTF8, "application/json");

            var response = await _httpClient.PostAsync($"api/classentities/{classEntityOwnerIdentityName}/trackeditems", trackedItemForCreation);

            if (response.IsSuccessStatusCode)
            {
                return(await JsonSerializer.DeserializeAsync <TrackedItemDto>(await response.Content.ReadAsStreamAsync()));
            }

            return(null);
        }