Author IAuthorService.Create(Author author, string password)
        {
            // validation
            if (string.IsNullOrWhiteSpace(password))
            {
                throw new AppException("Password is required");
            }

            if (_context.Authors.Any(x => x.Username == author.Username))
            {
                throw new AppException("Username '" + author.Username + "' is already taken");
            }

            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            author.PasswordHash = passwordHash;
            author.PasswordSalt = passwordSalt;

            _context.Authors.Add(author);
            _context.SaveChanges();

            return(author);
        }