public async Task <ActionResult <Product> > Delete(int id)
        {
            var product = await _productsDbContext.Products.FindAsync(id);

            if (product == null)
            {
                return(NotFound());
            }

            _productsDbContext.Remove(product);
            await _productsDbContext.SaveChangesAsync();

            return(Ok(product));
        }
        public async Task <ActionResult <Message> > Delete(int id)
        {
            try
            {
                var messsage = await _MessagesDbContext.Messages.FindAsync(id);

                if (messsage == null)
                {
                    _logger.LogError($"Message with id: {id}, hasn't been found in database.");
                    return(NotFound());
                }

                _MessagesDbContext.Remove(messsage);
                await _MessagesDbContext.SaveChangesAsync();

                return(Ok(messsage));
            }
            catch (Exception e)
            {
                _logger.LogError($"Exception Occured ", e.StackTrace);
                return(NotFound());
            }
        }