anchor.diff:  record_fields() ->
       record_info(fields, oc_chef_organization).
   
  -list(#oc_chef_organization{id = Id}, CallbackFun) ->
  -    CallbackFun({list_query(), [Id], [name]}).
  -
  -new_record(null, AuthzId, OrganizationData) ->
  -    % TODO: write id generator for org-less objects (see chef_object_base:make_org_prefix_id
  -    % and oc_chef_group:new_record for examples)
  -    Id = null,
  -
  -    Name = ej:get({<<"name">>}, OrganizationData),
  -    FullName = ej:get({<<"full_name">>}, OrganizationData),
  -    AssignedAt = ej:get({<<"assigned_at">>}, OrganizationData),
  +list(#oc_chef_organization{}, CallbackFun) ->
  +    CallbackFun({list_query(), [], [name]}).
  +
  +parse_binary_json(Bin) ->
  +    Org0 = chef_json:decode_body(Bin),
  +    Org = chef_object_base:set_default_values(Org0, ?DEFAULT_FIELD_VALUES),
  +    validate_org(Org). %% TODO need action specific version?
  +
  +validate_org(Org) ->
  +    case ej:valid(?VALIDATION_CONSTRAINTS, Org) of
  +        ok -> {ok, Org};
  +        Bad -> throw(Bad)
  +    end.
  +
  +%%
  +%% Open question: We don't expose json_class and chef_type fields currently, and the client doesn't have objects for them.
  +%% Is it worth sending at least chef_type fields?
  +%%
  +assemble_organization_ejson(#oc_chef_organization{name = Name,
  +                                                  full_name = FullName}) ->
  +    Org = {[{?NAME_FIELD, Name},
  +            {?FULL_NAME_FIELD, FullName} ]},
  +    chef_object_base:set_default_values(Org, ?DEFAULT_FIELD_VALUES).
  +
  +new_record(_OrgId, AuthzId, OrganizationData) ->
  +    Id = chef_object_base:make_guid(),
  +
  +    Name = ej:get({?NAME_FIELD}, OrganizationData),
  +    FullName = ej:get({?FULL_NAME_FIELD}, OrganizationData),
  +    %% should default date be factored elsewhere? Other dates are set in chef_object_base.
  +    %% Also, does assigned at really make sense when org creation is done in one step?
  +    AssignedAt = ej:get({<<"assigned_at">>}, OrganizationData, chef_object_base:sql_date(now)),
       #oc_chef_organization{
          id = Id,
          authz_id = AuthzId,
  
positive.code: list_query() ->
      list_organizations.
  
  bulk_get_query() ->
      erlang:error(not_implemented).
  
  
negative.code: %% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*-
  %% ex: ts=4 sw=4 et
  %% @author Tyler Cloke <tyler@getchef.com>
  %% @author Mark Anderson <mark@getchef.com>
  %% Copyright 2014 Opscode, Inc. All Rights Reserved.
  
  -module(oc_chef_organization).
  