//public string AddSIPAccount(SIPSorcery.Entities.SIPAccount sipAccount)
        public SIPAccountAsset AddSIPAccount(SIPAccountAsset sipAccountAsset)
        {
            Customer customer = AuthoriseRequest();

            sipAccountAsset.Owner = customer.CustomerUsername;

            //string validationError = SIPSorcery.Entities.SIPAccount.Validate(sipAccount);
            string validationError = SIPAccountAsset.ValidateAndClean(sipAccountAsset);

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

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

            string validationError = SIPAccountAsset.ValidateAndClean(sipAccountAsset);

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