private void Validate(AuthorProxy author)
        {
            if (author == null)
            {
                ThrowHttp.BadRequest(ErrorMessage.AUTHOR_REQUIRED);
            }

            if (string.IsNullOrWhiteSpace(author.FirstName))
            {
                ThrowHttp.BadRequest(ErrorMessage.FIRST_NAME_REQUIRED);
            }

            if (string.IsNullOrWhiteSpace(author.LastName))
            {
                ThrowHttp.BadRequest(ErrorMessage.LAST_NAME_REQUIRED);
            }

            if (!author.NobelPrize.HasValue)
            {
                ThrowHttp.BadRequest(ErrorMessage.NOBEL_PRIZE_REQUIRED);
            }

            var dateOfBirthError = _dateValidator.Validate(author.DateOfBirth);

            if (dateOfBirthError != null)
            {
                ThrowHttp.BadRequest(dateOfBirthError);
            }

            if (string.IsNullOrWhiteSpace(author.DateOfDeath))
            {
                return;
            }

            var dateOfDeathError = _dateValidator.Validate(author.DateOfDeath);

            if (dateOfDeathError != null)
            {
                ThrowHttp.BadRequest(dateOfDeathError);
            }
        }
        public ExpenseClaim CreateExpenseClaimFrom(ExpenseClaimInput expenseInput)
        {
            var expenseClaimDate = _validator.Validate(expenseInput.Date);

            _logger.LogInformation("Date has been successfully validated");
            var expenseClaim = new ExpenseClaim(expenseInput.CostCentre, expenseInput.Total, expenseInput.PaymentMethod)
            {
                Vendor = expenseInput.Vendor, Date = expenseClaimDate, Description = expenseInput.Description
            };

            _logger.LogInformation("Expense Claim successfully created.");
            return(expenseClaim);
        }
        private void Validate(BookProxy book)
        {
            if (book == null)
            {
                ThrowHttp.BadRequest(ErrorMessage.BOOK_REQUIRED);
            }

            if (string.IsNullOrWhiteSpace(book.Title))
            {
                ThrowHttp.BadRequest(ErrorMessage.TITLE_REQUIRED);
            }

            var dateError = _dateValidator.Validate(book.PublishDate);

            if (dateError != null)
            {
                ThrowHttp.BadRequest(dateError);
            }
        }