public SIPAccount AddSIPAccount(SIPAccount sipAccount)
        {
            Customer customer = AuthoriseRequest();

            sipAccount.Owner = customer.CustomerUsername;

            string validationError = SIPAccount.ValidateAndClean(sipAccount);

            if (validationError != null)
            {
                logger.Warn("Validation error in AddSIPAccount for customer " + customer.CustomerUsername + ". " + validationError);
                throw new ApplicationException(validationError);
            }
            else
            {
                return(SIPAccountPersistor.Add(sipAccount));
            }
        }
        public SIPAccount UpdateSIPAccount(SIPAccount sipAccount)
        {
            Customer customer = AuthoriseRequest();

            if (customer.AdminId != Customer.TOPLEVEL_ADMIN_ID && sipAccount.Owner != customer.CustomerUsername)
            {
                logger.Debug("Unauthorised attempt to update SIP account by user="******", on account owned by=" + sipAccount.Owner + ".");
                throw new ApplicationException("You are not authorised to update the SIP Account.");
            }

            string validationError = SIPAccount.ValidateAndClean(sipAccount);

            if (validationError != null)
            {
                logger.Warn("Validation error in UpdateSIPAccount for customer " + customer.CustomerUsername + ". " + validationError);
                throw new ApplicationException(validationError);
            }
            else
            {
                return(SIPAccountPersistor.Update(sipAccount));
            }
        }