public async Task <IActionResult> Create([FromBody] LabelCreateDto dto)
        {
            if (dto.Name == null || dto.Name.Length == 0)
            {
                return(BadRequest(new { Message = "Label name cannot be empty." }));
            }

            var label = await _repo.FindLabelByName(dto.Name);

            if (label != null)
            {
                return(BadRequest(new { Message = "Label with this name already exists." }));
            }

            var newLabel = _mapper.Map <Label>(dto);

            _repo.Add(newLabel);

            if (await _repo.SaveAll())
            {
                var labelToReturn = _mapper.Map <LabelDto>(newLabel);
                return(Ok(labelToReturn));
            }

            return(BadRequest(new { Message = "Error creating the label." }));
        }