@NotNull
  private static <S> PackagingElement<S> copyElement(@NotNull PackagingElement<? extends S> element, @NotNull Project project) {
    //noinspection unchecked
    final PackagingElement<S> copy = (PackagingElement<S>)element.getType().createEmpty(project);
    S state = element.getState();
    if (state != null) {
      copy.loadState(state);
    }
    else {
      copy.noStateLoaded();
    }
    return copy;
  }
@NotNull
  private static <S> PackagingElement<S> copyElement(@NotNull PackagingElement<? extends S> element, @NotNull Project project)