public bool SaveParsingResults(List <ParsingResult <Article> > parsingResults)
        {
            bool success = false;

            try
            {
                foreach (var parsingResult in parsingResults)
                {
                    parsingResult.Entity.CreatedAt = DateTime.ParseExact(parsingResult.Entity.CreatedAt, ArticleDateFormat, CultureInfo.InvariantCulture)
                                                     .ToString(MySqlDateFormat);

                    _articlesRepository.Insert(parsingResult.Entity);

                    parsingResult.ResultType = ParsingResultType.Saved;
                }

                success = true;
                _logger.LogInformation($"{parsingResults.Count} records were saved");
            }
            catch (Exception ex)
            {
                _logger.LogError("Error while saving parser records", ex);
            }

            return(success);
        }
        public IActionResult Add([FromBody] Article model)
        {
            try
            {
                if (model == null)
                {
                    return(BadRequest());
                }

                //var articleExists = _articlesRepository.GetByName(setting.name);
                //if (settingExists != null)
                //{
                //    return BadRequest("SettingWithSameNameExists");
                //}


                _articlesRepository.Insert(model);
                _articlesRepository.Save();

                return(NoContent());
            }
            catch (DataException ex)
            {
                _logger.LogError(ex, "ArticlesController/Add");
                return(BadRequest());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "ArticlesController/Add");
                throw;
            }
        }