private RoleRM CreateRole(Commands.V1.Role.Create cmd) { if (_repository.RoleExists(cmd.RoleName)) { throw new InvalidOperationException($"Role with name {cmd.RoleName} already exists"); } Role role = Role.Create(_roles++, RoleName.Create(cmd.RoleName), RoleDescription.Create(cmd.RoleDescription), cmd.IsActive); _repository.AddRole(role); return(Conversions.GetRoleRM(role)); }