public void SaveToken(DeviceInfo tokenInfo)
 {
     try
     {
         using (var dbCtx = new WeatherAppDbEntities())
         {
             dbCtx.DeviceInfo.Add(tokenInfo);
             dbCtx.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new DaoException(string.Format("Error inserting device token {0}. "+e.Message, tokenInfo.token), e);
     }
 }
        /// <summary>
        /// Adds device token to database
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="token"></param>
        /// <param name="deviceType"></param>
        public void SubscribeDeviceToken(string token, DeviceType deviceType, long userId, ApplicationType? appType)
        {
            try
            {
                if (IsTokenSubscribed(token))
                    return;

                DeviceInfo devInfo = new DeviceInfo
                {
                    userId = userId,
                    subscriptionDate = DateTime.Now.Date,
                    deviceType = deviceType,
                    token = token,
                    applicationId = appType
                };

                mssqlDaoFactory.GetDeviceTokenDao().SaveToken(devInfo);
            }
            catch (Exception e)
            {
                throw new DaoLayer.ApplicationException(e.Message);
            }
        }