/// <summary>
        /// Updates an existing domain.
        /// </summary>
        /// <param name="id">ID of the domain to update.</param>
        /// <param name="name">The new domain name to set.</param>
        /// <returns>Returns the updated domain.</returns>
        /// <exception cref="EntityNotFoundException">Thrown if no matching domain could be found.</exception>
        public async Task <Domain> UpdateDomain(Guid id, string name)
        {
            Domain domain = await GetDomain(id);

            domain.Name = name;
            return(await DomainRepository.UpdateDomain(domain));
        }