/// <summary>
		/// Adds a new user to the database.
		/// </summary>
		public static void AddUserToDatabase(User user)
		{
			using (ISession session = DatabaseManager.OpenSession())
			{
				ITransaction transaction = session.BeginTransaction();
				
				user.CreatedAt = DateTime.Now;
				user.UpdatedAt = DateTime.Now;
				user.EncryptPassword();
				
				session.Save(user);
				
				try
				{
					transaction.Commit();
					session.Close();
				}
				
				catch
				{
					session.Close();
					// if exception is duplicate in database throw the below exception.
					throw new Exception("Sorry. That user is already taken.");
				}
			}
		}