public virtual object ExecuteScalar(SqlCommand command, string tableNames)
        {
            FixCommandParameters(command);
            using (SqlConnection connection = new SqlConnection(_loginUser.ConnectionString))
            {
                object o;
                if (_useCache && DataCache != null)
                {
                    o = DataCache.GetScalar(command);
                    if (o != null)
                    {
                        return(o);
                    }
                }

                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadUncommitted);
                command.Connection  = connection;
                command.Transaction = transaction;
                try
                {
                    o = command.ExecuteScalar();
                    transaction.Commit();
                }
                catch (Exception e)
                {
                    transaction.Rollback();
                    e.Data["CommandText"] = command.CommandText;
                    ExceptionLogs.LogException(LoginUser, e, "BaseCollection.ExecuteScalar");
                    throw;
                }

                connection.Close();
                if (DataCache != null)
                {
                    if (tableNames == "")
                    {
                        tableNames = TableName;
                    }
                    DataCache.AddScalar(command, tableNames, _cacheExpirationSeconds, o, _loginUser.OrganizationID);
                }
                return(o);
            }
        }