/// <summary>
        /// Ajoute un nouveau ConstraintParameter
        /// </summary>
        /// <param name="constraintParameter">Nouveau ConstraintParameter</param>
        /// <param name="constraintSequenceId">Id de la ConstraintSequence</param>
        /// <returns>Message de retour</returns>
        public async Task <ConstraintParameter> AddConstraintParameter(ConstraintParameter constraintParameter, long constraintSequenceId)
        {
            if (constraintParameter == null)
            {
                throw new WrongParameterException("ConstraintSequenceDomain.AddConstraintParameter : constraintParameter is null.");
            }
            int cnt = await UnitOfWork.GetDbContext().ConstraintParameter
                      .Where(cp => cp.ParameterName == constraintParameter.ParameterName)
                      .CountAsync();

            if (cnt > 0)
            {
                throw new WrongParameterException($"ConstraintSequenceDomain.AddConstraintParameter : constraintParameter (parameter name = {constraintParameter.ParameterName}) is already existing.");
            }
            ConstraintSequence constraintSequence = await UnitOfWork.ConstraintSequenceRepository.GetById(constraintSequenceId);

            if (constraintSequence == null)
            {
                throw new WrongParameterException($"ConstraintSequenceDomain.AddConstraintParameter : ConstraintSequence (id = {constraintSequenceId}) don't exist.");
            }

            UnitOfWork.ConstraintParameterRepository.PrepareAddForObject(constraintParameter);
            constraintParameter.ReferenceSequence = constraintSequence.Reference;
            constraintParameter.OrderSequence     = constraintSequence.Order;

            int nbr = await UnitOfWork.GetDbContext().SaveChangesAsync();

            if (nbr <= 0)
            {
                throw new DatabaseException("ConstraintSequenceDomain.AddConstraintParameter : impossible to save ConstraintParameter.");
            }

            return(constraintParameter);
        }
        /// <summary>
        /// Ajoute une nouvelle séquence de contrainte.
        /// </summary>
        /// <param name="constraintSequence">Nouvelle SequenceConstraint</param>
        /// <param name="constraintId">Id de la contrainte</param>
        /// <returns>Message de retour</returns>
        public async Task <ConstraintSequence> AddConstraintSequence(ConstraintSequence constraintSequence, long constraintId)
        {
            if (constraintSequence == null)
            {
                throw new WrongParameterException("ConstraintSequenceDomain.AddConstraintSequence : ConstraintSequence is null.");
            }
            Constraint constraint = await UnitOfWork.ConstraintRepository.GetById(constraintId);

            if (constraint == null)
            {
                throw new WrongParameterException($"ConstraintSequenceDomain.AddConstraintSequence : Constraint (id = {constraintId}) don't exist.");
            }

            UnitOfWork.ConstraintSequenceRepository.PrepareAddForObject(constraintSequence);
            constraintSequence.Constraint = constraint;

            int nbr = await UnitOfWork.GetDbContext().SaveChangesAsync();

            if (nbr <= 0)
            {
                throw new DatabaseException("ConstraintSequenceDomain.AddConstraintSequence : impossible to save ConstraintSequence.");
            }

            return(constraintSequence);
        }