@Atomic
  public static ActionError run(String selectedGroupProposalOID) throws FenixServiceException {
    final GroupProposal groupProposal = FenixFramework.getDomainObject(selectedGroupProposalOID);
    if (groupProposal != null) {
      final Proposal proposal = groupProposal.getFinalDegreeWorkProposal();
      final FinalDegreeWorkGroup group = groupProposal.getFinalDegreeDegreeWorkGroup();

      if (proposal != null && group != null) {
        final Proposal proposalAttributedToGroup = group.getProposalAttributedByTeacher();
        if (proposalAttributedToGroup != null && proposalAttributedToGroup != proposal) {

          return new ActionError(
              "error.message.GroupAlreadyAttributed",
              proposalAttributedToGroup.getProposalNumber());
        }

        if (proposal.getGroupAttributedByTeacher() == null
            || proposal.getGroupAttributedByTeacher() != group) {
          proposal.setGroupAttributedByTeacher(group);
          for (GroupProposal otherGroupProposal : group.getGroupProposalsSet()) {
            Proposal otherProposal = otherGroupProposal.getFinalDegreeWorkProposal();
            if (otherProposal != proposal && group == otherProposal.getGroupAttributedByTeacher()) {
              otherProposal.setGroupAttributedByTeacher(null);
            }
          }
        } else {
          proposal.setGroupAttributedByTeacher(null);
        }
      }
    }
    return null;
  }