/// <summary> /// /// </summary> /// <param name="item"></param> /// <returns>A saved entity, otherwise, same passed object.</returns> public T Add(T item) { try { Context.Set <T>().Attach(item); Context.Entry(item).State = EntityState.Added; Context.SecureSaveChanges(); } catch (Exception ex) { var dataException = DataLayerExceptionFactory.Create(ex, item); throw dataException; } return(item); }