protected DbOperationStatus UpdateEntity <TE>(TE entity) where TE : class
        {
            var opStatus = new DbOperationStatus
            {
                OperationSuccessStatus = false,
                AffectedIndices        = null
            };

            try
            {
                DataContext.Set <TE>().Attach(entity);
                DataContext.Entry(entity).State = EntityState.Modified;
                opStatus.OperationSuccessStatus = DataContext.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                opStatus = DbOperationStatus.CreateFromException("Error updating " + entity.GetType(), ex);
            }
            return(opStatus);
        }
        public DbOperationStatus ExecuteStoredProcedure(string command)
        {
            if (command == null)
            {
                throw new ArgumentException("The stored procedure must be provided");
            }

            var opStatus = new DbOperationStatus {
                OperationSuccessStatus = false
            };

            try
            {
                opStatus.OperationSuccessStatus = DataContext.Database.ExecuteSqlCommand(command) > 0;
            }
            catch (Exception ex)
            {
                opStatus = DbOperationStatus.CreateFromException("Error executing Stored Procedure", ex);
            }

            return(opStatus);
        }