public string Validate(Cart model)
        {
            try
            {
                _logger.LogInformation("Start cart validating.");
                StringBuilder builder = new StringBuilder();

                if (!ValidationUtilities.MoreThanValueRule(model.Count))
                {
                    builder.AppendLine("You can't add zero products to cart.");
                }

                string message = builder.ToString();
                if (!string.IsNullOrEmpty(message))
                {
                    return(message);
                }

                _logger.LogInformation("Cart successfuly validated.");
                return(null);
            }
            catch (Exception exception)
            {
                _logger.LogError(exception.Message);
                throw exception;
            }
        }
        public async Task <string> Validate(Delivery model)
        {
            try
            {
                _logger.LogInformation("Start delivery validating.");
                StringBuilder builder = new StringBuilder();

                if (!ValidationUtilities.NotEmptyRule(model.Name))
                {
                    builder.AppendLine("Delivery name should not be empty.");
                }
                if (!ValidationUtilities.OnlyLettersNumbersAndUnderscorcesRule(model.Name))
                {
                    builder.AppendLine("Delivery name should contains only letters, dots, commas and number.");
                }
                if (!ValidationUtilities.MoreThanValueLengthRule(model.Name, 5))
                {
                    builder.AppendLine("Delivery name should be longer than 5 symbols.");
                }
                if (!ValidationUtilities.MoreThanValueRule(model.DeliveryPrice, 0))
                {
                    builder.AppendLine("Delivery price should be greater than zero.");
                }

                var models = await _dao.Get(new DeliveryGetOptions
                {
                    Name       = model.Name,
                    ExcludeIds = new List <int> {
                        model.Id
                    }
                });

                if (models.Count() > 0)
                {
                    builder.AppendLine("Delivery with same name have been already created. Please try another name.");
                }

                string message = builder.ToString();
                if (!string.IsNullOrEmpty(message))
                {
                    return(message);
                }

                _logger.LogInformation("Delivery successfuly validated.");
                return(null);
            }
            catch (Exception exception)
            {
                _logger.LogError(exception.Message);
                throw exception;
            }
        }